用decodetime()函数呀
procedure TForm1.Button1Click(Sender: TObject);var
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= Now;
DecodeDate(Present, Year, Month, Day);
Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
+ IntToStr(Month) + ' of Year ' + IntToStr(Year);
DecodeTime(Present, Hour, Min, Sec, MSec);
Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
+ IntToStr(Hour);
end;
试试吧
procedure TForm1.Button1Click(Sender: TObject);var
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= Now;
DecodeDate(Present, Year, Month, Day);
Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
+ IntToStr(Month) + ' of Year ' + IntToStr(Year);
DecodeTime(Present, Hour, Min, Sec, MSec);
Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
+ IntToStr(Hour);
end;
试试吧
2. 自己写代码扫描字符串
procedure GetSystemTime(var lpSystemTime: TSystemTime); stdcall;方法如下:procedure TForm1.Button1Click(Sender: TObject);
var systime : _SYSTEMTIME;
begin GetSystemTime( systime ) thenend; _SYSTEMTIME是声明在windows单元中的结构,其结构如下 systime.wYear //年
systime.wMonth //月
systime.wDayOfWeek //................
systime.wDay
systime.wHour
systime.wMinute
systime.wSecond
systime.wMilliseconds