Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datetime - how to compare the time?

Status
Not open for further replies.

effennel

Technical User
Oct 15, 2002
60
CA
I have a variable using the datetime format "0000-00-00 00:00:00"

How do I proceed to determine if the hour is between 10:00:00 and 15:59:59?

Thanks
FnL
 
I would split the date string at the space using explode(), which will give me a date-part and a time-part in an array.

Since the tim-part is very regular, time order is the same a alphabetical order, so a simple string comparisons should work. I'd just use "<" and ">",


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top