Page 1 of 1

time() question ...

Posted: Thu Feb 24, 2005 9:58 pm
by zick
i was wonderring if anyone had a little tidbit of code that uses the time() function to generate the unix timestamp (seconds from the unix epoch) that is the very beginning of the next day (12:00 midnight).

i want make a cookie expire exactly at midnight the day it is set, no matter when it is set. the best i can seem to do is get it to last for 24 hours.

thanx for any code posted ...

Posted: Thu Feb 24, 2005 10:01 pm
by feyd

Code: Select all

strtotime('tomorrow 00:00:00');

Posted: Thu Feb 24, 2005 10:32 pm
by zick
why do i always miss these little helpful functions? man!
i was in the process of writing this function that divided the days from the epoch and took the remainder and figured out what was left over.
gosh, it was starting to get wiked.

well, i thank you for giving me something almost too easy it seems unfair to my programming abilities (or lack thereof).

Posted: Thu Feb 24, 2005 10:34 pm
by feyd
strtotime() is one of those great hidden functions.. it's so useful for so many things.. :)