Welcome Guest, Not a member yet? Register   Sign In
Beginning of the day for given unix timestamp
#1

[eluser]tolyx[/eluser]
I'm hopeless when it comes to date manipulation!

If I have a Unix timestamp that translates to June 5th, 2009 at 2:36pm/14:36, how do I manipulate it to return June 5th, 2009 at 12:00am/00:00?
#2

[eluser]xwero[/eluser]
Code:
strtotime(date('Y-m-d',$timestamp).' 00:00:00');
#3

[eluser]tolyx[/eluser]
Ha - simple answer to simple problem. *red face*

Thanks.
#4

[eluser]Dam1an[/eluser]
One way is to format it, but only specify the date part you want, so something like
Code:
$data = date('M jS, Y', $time);

And then manually append the '12:00am' to it

Or, you could divide the timestamp by 60*60*24 (seconds in a day) and subtract that from the timestamp

Edit: beat by xwero... again




Theme © iAndrew 2016 - Forum software by © MyBB