About time functions

xiaoxiao2021-03-06  73

[0] Add the following statement before the Application.run statement in the project file, you can not let the master form display at runtime: Application.showMainform: = false;

[1] Display Setting Time Dialog SHELLEXECUTE (Handle, 'Open', 'Control', 'DATE / TIME', NIL, SW_SHOW);

[2] Formator ('YYYY MMMM', MyDate) Returns [2008 December]

[3] // Get Date: = trunc (datetime); // Get Time Time: = FRAC (DateTime);

[3] number of days procedure TForm1.Button10Click (Sender: TObject) of any month; function DaysInMonth (ADate: TDateTime): Integer; var MyYear, MyMonth, MyDay: Word; MyDayTable: TDayTable; tmpBool: Boolean; begin DecodeDate (ADate, Myyear, mymonth, myday; tmpBool: = isleApyear (myyear); mydaytable: = monthdays [tmpBool]; result: = mydayTable [mymonth];

var MyDate: TDateTime; tmpStr: String; tmpInt: Integer; begin MyDate: = strToDateTime ( '2003-12-01'); tmpStr: = FormatDateTime ( 'yyyy mmmm', MyDate); tmpInt: = DaysInMonth (MyDate); ShowMessage (Tmpstr 'has' INTSTOSTR (TMPINT) 'ìì'); END;

[3] Change system time 1, define variables var systemtime: TsystemTime; 2, conversion date DateTimetosystemTime (STRTODATETIME ('1999-09-01 11:12:12'), systemtime); 3, change the system date setsystemTime (SystemTime); The system date has changed, but because the BUG exists in the API function setsystemTime () itself, after you change the system date, wait for a while, you will see the system's date is right, but the time is wrong, not us Set 11:12:12, such a problem seems to be Microsoft to solve

/ Method 2 / {setDate sets the current date in the operation system. Valid} {parameter Ranges Are: Year 1980-2099, Month 1-12 and day} {1-31. If the date is not valid, The function call IS ignored} procedure SetDate. (Year, Month, Day: Word); assembler; asm MOV CX, Year MOV DH, BYTE PTR Month MOV DL, BYTE PTR Day MOV AH, 2BH INT 21Hend; {SetTime sets the time in the operating system {Parameter Ranges Are: Hour 0-23, Minute 0-59, Second 0-59 and} {sec100 (Hundredths of Seconds) 0-99. If the time is not} {valid, The function call is ignored. Procedure setTime (Hour, minute, second, sec100: word); Assembler; ASM MOV CH, BYTE PTR Second Mov DH, BYTE PTR Second Mov DL, BYTE PTR SEC100 MOV AH, 2DH INT 21hend;

Function setsystemDatetime (year, month, day, hour, minute, second): integer; export; begin setdate (Year, Month, day); Settime (Hour, Minute 1, Second, 0); Result: = 1; END;

转载请注明原文地址:https://www.9cbs.com/read-109165.html

New Post(0)