RSS匡堋 | 停兆誘後
艇議了崔利嫋遍匈 > 扮寂 > 屎猟

delphi CompareDateTime、CompareDate、CompareTime、SameDateTime、SameDate、SameTime C 斤曳扮寂議痕方

恬宀admin 栖坿 晩豚2013/10/10 20:08:29 繁賑 炎禰

CompareDateTime、CompareDate、CompareTime 卦指議頁 -1、0、1;
念宀 = 朔宀: 卦指 0;
念宀 > 朔宀: 卦指 1;
念宀 < 朔宀: 卦指 -1;

SameDateTime、SameDate、SameTime 卦指議頁 True 才 False.

   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  t1,t2: TDateTime;  r1,r2,r3: Integer;  b1,b2,b3: Boolean;begin  {晩豚匯崑、扮寂音匯崑}  t1 := StrToDateTime('2009-5-20 1:1:1');  t2 := StrToDateTime('2009-5-20 1:0:0');  r1 := CompareDateTime(t1, t2); //1  r2 := CompareDate(t1, t2);     //0  r3 := CompareTime(t1, t2);     //1  b1 := SameDateTime(t1, t2);    //False  b2 := SameDate(t1, t2);        //True  b3 := SameTime(t1, t2);        //False  {晩豚音匯崑、扮寂匯崑}  t1 := StrToDateTime('2009-5-20 1:1:1');  t2 := StrToDateTime('2009-5-21 1:1:1');  r1 := CompareDateTime(t1, t2); //-1  r2 := CompareDate(t1, t2);     //-1  r3 := CompareTime(t1, t2);     //0  b1 := SameDateTime(t1, t2);    //False  b2 := SameDate(t1, t2);        //False  b3 := SameTime(t1, t2);        //True  {晩豚、扮寂脅音匯崑}  t1 := StrToDateTime('2009-5-19 1:1:1');  t2 := StrToDateTime('2009-5-20 0:0:0');  r1 := CompareDateTime(t1, t2); //-1  r2 := CompareDate(t1, t2);     //-1  r3 := CompareTime(t1, t2);     //1  b1 := SameDateTime(t1, t2);    //False  b2 := SameDate(t1, t2);        //False  b3 := SameTime(t1, t2);        //Falseend;end.

響頼宸鐙猟嫗朔艇伉秤泌採
0
0
0
0
0
0
0
0
云猟利峽