time() question ...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zick
Forum Commoner
Posts: 33
Joined: Thu Aug 14, 2003 3:18 pm

time() question ...

Post 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 ...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

strtotime('tomorrow 00:00:00');
zick
Forum Commoner
Posts: 33
Joined: Thu Aug 14, 2003 3:18 pm

Post 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).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

strtotime() is one of those great hidden functions.. it's so useful for so many things.. :)
Post Reply