delphi MonthOfTheYear、WeekOfTheYear、WeekOfTheMonth、DayOfTheYear … 相对时间


本文整理自网络,侵删。

 

SysUtils.DayOfWeek();

DateUtils.MonthOfTheYear();
DateUtils.WeekOfTheYear();
DateUtils.WeekOfTheMonth();
DateUtils.NthDayOfWeek();
DateUtils.DayOfTheYear();
DateUtils.DayOfTheMonth();
DateUtils.DayOfTheWeek();
DateUtils.SysUtils.DayOfWeek();

DateUtils.HourOfTheYear();
DateUtils.HourOfTheMonth();
DateUtils.HourOfTheWeek();
DateUtils.HourOfTheDay();

DateUtils.MinuteOfTheYear();
DateUtils.MinuteOfTheMonth();
DateUtils.MinuteOfTheWeek();
DateUtils.MinuteOfTheDay();
DateUtils.MinuteOfTheHour();

DateUtils.SecondOfTheYear();
DateUtils.SecondOfTheMonth();
DateUtils.SecondOfTheWeek();
DateUtils.SecondOfTheDay();
DateUtils.SecondOfTheHour();
DateUtils.SecondOfTheMinute();

DateUtils.MilliSecondOfTheYear();
DateUtils.MilliSecondOfTheMonth();
DateUtils.MilliSecondOfTheWeek();
DateUtils.MilliSecondOfTheDay();
DateUtils.MilliSecondOfTheHour();
DateUtils.MilliSecondOfTheMinute();
DateUtils.MilliSecondOfTheSecond();

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs;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;  w: Word;  c: Cardinal;  i: Int64;begin  t := StrToDateTime('2009-5-20 11:22:33');  {指定时间是年度第几月份}  w := MonthOfTheYear(t);  //5  {指定时间分别是年、月的第几周}  w := WeekOfTheYear(t);  //21  w := WeekOfTheMonth(t); //3  w := NthDayOfWeek(t);   //3  {指定时间分别是年、月、周的第几天}  w := DayOfTheYear(t);   //140  w := DayOfTheMonth(t);  //20  w := DayOfTheWeek(t);   //3  w := SysUtils.DayOfWeek(t); //4; DayOfWeek 和 DayOfTheWeek 类似, 但算法不同  {指定时间分别是年、月、周、日的第几小时}  w := HourOfTheYear(t);  //3347  w := HourOfTheMonth(t); //467  w := HourOfTheWeek(t);  //59  w := HourOfTheDay(t);   //11  {指定时间分别是年、月、周、日、时的第几分钟}  c := MinuteOfTheYear(t);  //200842  w := MinuteOfTheMonth(t); //28042  w := MinuteOfTheWeek(t);  //3562  w := MinuteOfTheDay(t);   //682  w := MinuteOfTheHour(t);  //22  {指定时间分别是年、月、周、日、时、分的第几秒}  c := SecondOfTheYear(t);   //12050553  c := SecondOfTheMonth(t);  //1682553  c := SecondOfTheWeek(t);   //213753  c := SecondOfTheDay(t);    //40953  w := SecondOfTheHour(t);   //1353  w := SecondOfTheMinute(t); //33  {指定时间分别是年、月、周、日、时、分、秒的第几毫秒}  i := MilliSecondOfTheYear(t);   //12050553000  c := MilliSecondOfTheMonth(t);  //1682553000  c := MilliSecondOfTheWeek(t);   //213753000  c := MilliSecondOfTheDay(t);    //40953000  c := MilliSecondOfTheHour(t);   //1353000  c := MilliSecondOfTheMinute(t); //33000  w := MilliSecondOfTheSecond(t); //0end;end.

相关阅读 >>

Delphi 中的哈希表: thashedstringlist

Delphi有无生成空格的函数,like vb的space(1)

Delphi里的compile和build都能产生可执行文件,有什么区别啊?

Delphi unigui确认对话框

Delphi fdconnection自动重连

Delphi 监控其它进程

Delphi 写开关防火墙代码

Delphi memo1自动循环上下滚屏

Delphi消息发送字符串

Delphi 写日志函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...