RSS订阅 | 匿名投稿
您的位置:网站首页 > 时间 > 正文

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

作者:admin 来源: 日期:2013/10/10 20:07:14 人气: 标签:

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.

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址: