I have been banging my head with this for a while now. Does someone know how I can check to see if $theDate
is within the range of 24 hours FROM NOW.
This is the code I have come up with but it doesn't seem to work :(
if (time() <= ($theDate + 86400)) {
// current time is 86400 (seconds in 24 hours) or less than stored time
}
Note: $theDate
is unix timestamp.
Any help would be appreciated.
Thanks :)
You have it backwards:
Do you always want the range to be 24 hours? Remember that there are sometimes 23 or 25 hours in a day when changing from/to DST.
A method that will take that into account is this:-
See the DateTime manual for more information on these very useful classes.