Tuesday, March 1, 2011

Easy way to compare dates

Did you know that you can easily compare dates by using the "EncodeDate()"? Here are some examples:

 
uses
  SysUtils;

{...}

if(Date > EncodeDate( 1997, 1, 1 ))then
begin
  { display "this program has expired" }
end;

{...}

if( EncodeDate( 1997, 1, 1 )
  > EncodeDate( 1996, 1, 1 ) ) then
begin
  {...}
end;
Listing #1 : Delphi code. Download datecomp (0.27 KB).

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum