hefterr
asked on
Comparing the Time in ColdFusion
Hi Experts,
I know this must sound simple - but these are the ones I get hung up on.
I have a program where I want to see if the current time is after 6 am (or inversely between 12 midnight and 5:59.9999 am of the current day.
Do you use Datediff?, Datecompare?
Thanks in advance,
hefterr
I know this must sound simple - but these are the ones I get hung up on.
I have a program where I want to see if the current time is after 6 am (or inversely between 12 midnight and 5:59.9999 am of the current day.
Do you use Datediff?, Datecompare?
Thanks in advance,
hefterr
ASKER
Hi agx,
For extra credit :)
How would I tell if the current time is after 6:15 am?
Thank again!
For extra credit :)
How would I tell if the current time is after 6:15 am?
Thank again!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks much! When I googled this I saw involved solutions. Yours are more elegant.
I owe you another 50 points for the extra credit :)
I owe you another 50 points for the extra credit :)
I love how date/time stuff usually turns out to be simpler than you think. Three cheers for date/time functions :)
<cfif datePart("h", now()) lt 6>
it's before 6AM
<cfelse>
it's on or after 6AM
</cfif>