timer不能取系统时间
它只是一个定时器,是用相对时间来触发时间的
可以用GetSystemtime
或者date,now等函数来取得系统时间
它只是一个定时器,是用相对时间来触发时间的
可以用GetSystemtime
或者date,now等函数来取得系统时间
解决方案 »
- Access violation at address 582d86a9 in module 'wmp.dll'
- 【FastReport 问题】fastreport 报表如何使用户可以选择打印机和打印页码?
- 如何通过代理服务器访问WebService服务?
- 怎么使窗口上的所有控件都能随着窗体大小的改变而自适应?在线等待!
- 那位老大有VXML方面的资料否?
- 求职:delphi方面的。
- 为什么用ADOConnection.Open时会报错“尚未调用CoInitilize”?
- 怎样在PARADOX表里设置一个字段不能为空?
- 怎么想另一个程序发送消息
- 有没有创建整条路径的函数?
- 关于access中的自增字段问题
- 我使用线程的时候会出现一个错误?
hour,min,sec,msec:word;
Decodetime(now,hour,min,sec,msec)
就这样啊,TIMER不能取时间吗,那我取的时间是从那来的!???
datatimetostr(time);中的time,delphi会自动打开SysUtils单元。你会看到这个函数的定义:
function Time: TDateTime;
var
SystemTime: TSystemTime;
begin
GetLocalTime(SystemTime);
with SystemTime do
Result := EncodeTime(wHour, wMinute, wSecond, wMilliSeconds);
end;
注意这里的SystemTime只是一个当前时间,并没有日期的信息。所以你可以想象1899-12-30这一天
可能就是系统所能表示的最早时间。
当前时间的作用。取当前时间就用Now吧。那句话就写成:DataTimeToStr(Now);
var
DateTime : TDateTime;
str : string;
begin
DateTime := Time; // store the current date and time
str := TimeToStr(DateTime); // convert the time into a string
Caption := str; // display the time on the form's caption
{ Note This could have been done with the following line of code:
Caption := TimeToStr(Time); }
end;