Board index » delphi » DateTime Compare?

DateTime Compare?

How do I take a date/time string like   08/03/1998  13:24    and
compare it to the current time to see if we've passed it?  Tks.
 

Re:DateTime Compare?


In article <35c4d92c.19128...@news.dialnet.net>, m...@here.net says...
Quote
> How do I take a date/time string like   08/03/1998  13:24    and
> compare it to the current time to see if we've passed it?  Tks.

Hi:

Try ->

var
    dnow,dcompare: TDateTime;

begin
  d:=now;
  dcompare:=StrToDateTime(Edit1.Text)
        If Decompare<d then
        {insert what you want done if the string date is less than NOW
        date}
        else
        {insert what you want done when string date is equal to or greater
        than NOW date}

I am using D2 C/S, so there may be a better way in D3 or D4. I am new to
this, but have a program that relies on date compares and has been
successful.

Good luck.

Bob

remove the 9's from my email address

Re:DateTime Compare?


Hi there
you could do something like

if Now<StrToDateTime(TheStringWithTime) then begin
  whatever
end;

Quote
Padre wrote:
> How do I take a date/time string like   08/03/1998  13:24    and
> compare it to the current time to see if we've passed it?  Tks.

Other Threads