随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

//声明
GetLocalTime(
  var lpSystemTime: TSystemTime {TSystemTime 结构}
);                              {无返回值}

//设置本地时间
SetLocalTime(
  const lpSystemTime: TSystemTime {TSystemTime 结构}
): BOOL;

//SetSystemTime 设置的是格林尼治时间
SetSystemTime(
  const lpSystemTime: TSystemTime {TSystemTime 结构}
): BOOL;

//TSystemTime 是 _SYSTEMTIME 结构的重定义:
_SYSTEMTIME = record
  wYear: Word;         {年}
  wMonth: Word;        {月}
  wDayOfWeek: Word;    {周}
  wDay: Word;          {日}
  wHour: Word;         {时}
  wMinute: Word;       {分}
  wSecond: Word;       {秒}
  wMilliseconds: Word; {毫秒}
end;

//举例: procedure TForm1.FormCreate(Sender: TObject); var T: TSystemTime; begin GetSystemTime(T); Memo1.Clear; with Memo1.Lines do begin add(Format('年: %d',[T.wYear])); add(Format('月: %d',[T.wMonth])); add(Format('周: %d',[T.wDayOfWeek])); add(Format('日: %d',[T.wDay])); add(Format('时: %d',[T.wHour])); add(Format('分: %d',[T.wMinute])); add(Format('秒: %d',[T.wSecond])); add(Format('毫秒: %d',[T.wMilliseconds])); end; end;
//效果图:

posted on 2008-02-13 11:31  万一  阅读(...)  评论(...编辑  收藏