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

delphi 分解时间 –DecodeDate、DecodeTime … DecodeDateTime …

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

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,21,5; 最后的 5 表示周四  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; 2009 年第 141 天  DecodeDateWeek(t, Year, Week, Day);  ShowMessageFmt('%d,%d,%d', [Year, Week, Day]); //2009,21,4; 2009 年第 21 周, 周 4  DecodeDateMonthWeek(t, Year, Month, Week, Day);  ShowMessageFmt('%d,%d,%d,%d', [Year, Month, Week, Day]); //2009,5,3,4; 2009 年 5 月的第 3 周, 周 4  DecodeDayOfWeekInMonth(t, Year, Month, Week, Day);  ShowMessageFmt('%d,%d,%d,%d', [Year, Month, Week, Day]); //2009,5,3,4end;end.

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