Sysutils. decodedate (); sysutils. decodedatefully (); sysutils. decodetime (); dateutils. decodedatetime (); dateutils. decodedateday (); dateutils. decodedateweek (); dateutils. decodedatemonthweek (); dateutils. decodedayofweekinmonth ();
Unit unit1; interfaceuses 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,; the last 5 represents the decodetime (T, hour, Min, SEC, MSEC); showmessagefmt ('% d, % d', [hour, Min, SEC, msec]); // 11,22, 33,999 decodedatetime (t, year, month, day, hour, Min, SEC, msec); showmessagefmt ('% d, % d ', [year, month, day, hour, Min, SEC, msec]); // 999 decodedateday (T, year, day ); showmessagefmt ('% d, % d', [year, day]); // 2009,141; decodedateweek (T, year, week, day), January 1, 141st ); showmessagefmt ('% d, % d, % d', [year, week, day]); // 2009,21, 4; 21st week, Week 4 decodedatemonthweek (T, year, month, week, day); showmessagefmt ('% d, % d', [year, month, week, day]); // 2009, 5, 3, 4; week 4, 3rd decodedayofweekinmonth (T, year, month, week, day); showmessagefmt ('% d, % d', [year, month, week, day]); // 2009, 5, 3, 4end; end.
Dateutils-Function