Jump to content

How to format time and date in a variable, NOT the current time/date.


kernelgpf

Recommended Posts

Subject says it all.. I'm basically trying to set the time to the END of the current hour, with this code..

$rundate=date('Y-m-d h:00:00', strtotime("+1 hour"));

But the zeros disappear once the hour is added, and minutes and seconds take their place, I DON'T want this to happen. Any advice?
[quote author=kenrbnsn link=topic=121820.msg501560#msg501560 date=1168457376]
That's going to give the OP what he doesn't want. I tried the OP's code and it worked find for me.
Ken
[/quote]

Same here... if you're having an issue with it, though, just figure it to the hour and then add the zeros after:
[code]
<?php
$rundate=date('Y-m-d h', strtotime("+1 hour")) . ':00:00';
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.