know if it is a valid time or date

how will i identify when the time or date inputed
is invalid or not a time or date format
ex.
  46:23:12 am ------- error (46)
  00:99:11 am ------- error (99)
  07:00:00 ob ------- error (ob)
etc...
mvalezAsked:
Who is Participating?
 
rwilson032697Connect With a Mentor Commented:
I would say that StringToDateTime will throw an exception if you feed it a dud time.

Try this:

var
  TheTime : TDateTime;
...
try
  TheTime := StringToDateTime('46:23:12 am');
except
  ShowMessage('Oops - that was a bad one!');
end;

Cheers,

Raymond.

0
 
mvalezAuthor Commented:
thank you very much....
0
 
mvalezAuthor Commented:
thank you very much....
0
All Courses

From novice to tech pro — start learning today.