定义一个_SYSTEMTIME类型的变量typedef struct _SYSTEMTIME {  // st  
    WORD wYear; 
    WORD wMonth; 
    WORD wDayOfWeek; 
    WORD wDay; 
    WORD wHour; 
    WORD wMinute; 
    WORD wSecond; 
    WORD wMilliseconds; 
} SYSTEMTIME; 
 MemberswYearSpecifies the current year. wMonthSpecifies the current month; January = 1, February = 2, and so on. wDayOfWeekSpecifies the current day of the week; Sunday = 0, Monday = 1, and so on. wDaySpecifies the current day of the month. wHourSpecifies the current hour. wMinuteSpecifies the current minute. wSecondSpecifies the current second. wMillisecondsSpecifies the current millisecond

解决方案 »

  1.   

    procedure Modify_CurrentDate(Year,Month,Day:word);
    var
       TempSystemTime:systemTime;
    begin
       TempSystemTime.wYear:=Year;
       TempSystemTime.wMonth:=Month;
       TempSystemTime.wDay:=Day;
       with TempSystemTime do
          DecodeTime(Time,wHour,wMinute,wSecond,wmilliSeconds);
       setsystemTime(Tempsystemtime);
    end;
    修改当前日期
    修改当前时间也类似
      

  2.   

    //==============================================================================
    //修正日期、时间****************************************************************
    //==============================================================================
    procedure SetDateTime(DateTime: TDateTime);
    var SystemTime: TSystemTime;
    begin
      DateTimeToSystemTime(DateTime,SystemTime);
      SetLocalTime(SystemTime);
    end;
      

  3.   

    WINDOWS API函数基本上在DELPHI自带的WINDOWS.PAS中都有定义的,自己好好看看吧