SysUtils.DecodeDate();
SysUtils.DecodeDateFully();
SysUtils.DecodeTime();
DateUtils.DecodeDateTime();
DateUtils.DecodeDateDay();
DateUtils.DecodeDateWeek();
DateUtils.DecodeDateMonthWeek();
DateUtils.DecodeDayOfWeekInMonth();
Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, Stdctrls;
Type
TForm1 = Class (Tform)
Procedure Formcreate (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Uses dateutils;
Procedure Tform1.formcreate (Sender:tobject);
Var
T:tdatetime;
Year, Month, Day, Week:word;
Hour, Min, Sec, Msec:word;
Begin
T: = Encodedatetime (2009, 5, 21, 11, 22, 33, 999);
Decodedate (t, year, Month, day);
SHOWMESSAGEFMT ('%d,%d,%d ', [year, Month, Day]); 2009,5,21
Decodedatefully (t, year, Month, Day, Week);
SHOWMESSAGEFMT ('%d,%d,%d,%d ', [year, Month, Day, Week]); 2009,5,21,5; The last 5 represents Thursday
Decodetime (t, Hour, Min, Sec, MSEC);
SHOWMESSAGEFMT ('%d,%d,%d,%d ', [Hour, Min, Sec, MSec]); 11,22,33,999
Decodedatetime (t, year, Month, Day, Hour, Min, Sec, MSEC);
SHOWMESSAGEFMT ('%d,%d,%d,%d,%d,%d,%d ', [year, Month, Day, Hour, Min, Sec, MSec]); 2009,5,21,11,22,33,999
Decodedateday (T, year, day);
SHOWMESSAGEFMT ('%d,%d ', [year, Day]); 2009,141; 141th Day of 2009
Decodedateweek (t, year, Week, day);
SHOWMESSAGEFMT ('%d,%d,%d ', [year, Week, Day]); 2009,21,4; 21st Week of 2009, Week 4
Decodedatemonthweek (t, year, Month, Week, day);
SHOWMESSAGEFMT ('%d,%d,%d,%d ', [year, Month, Week, Day]); 2009,5,3,4; 3rd Week of May 2009, Week 4
Decodedayofweekinmonth (t, year, Month, Week, day);
SHOWMESSAGEFMT ('%d,%d,%d,%d ', [year, Month, Week, Day]); 2009,5,3,4
End
End.