Time till Midnight

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
Pezmc
Forum Commoner
Posts: 53
Joined: Mon Nov 06, 2006 2:15 pm

Time till Midnight

Post by Pezmc »

I am trying to set a cookie that will expire at midnight, what is the easiest was to do this?
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

[feyd@home]>php -r "$t = strtotime('tomorrow'); $s = date('Y-m-d 00:00:00', $t); $t = strtotime($s); echo date('Y-m-d H:i:s', $t); echo PHP_EOL, $t - time();"
2007-01-23 00:00:00
35980
Post Reply