apw Posted February 1, 2010 Share Posted February 1, 2010 Im trying to write a very simple code that uses date("U") such as $thetime=date("U"); $timelimit=$thetime-3600*; which throws out 1265005026 but how do i change this to a hour/minute/second? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/190519-working-with-date/ Share on other sites More sharing options...
MasterACE14 Posted February 1, 2010 Share Posted February 1, 2010 http://au2.php.net/manual/en/function.date.php Quote Link to comment https://forums.phpfreaks.com/topic/190519-working-with-date/#findComment-1004927 Share on other sites More sharing options...
PravinS Posted February 1, 2010 Share Posted February 1, 2010 You can you date function with hour/minute/second as first parameter and the timestamp value as second parameter Quote Link to comment https://forums.phpfreaks.com/topic/190519-working-with-date/#findComment-1004928 Share on other sites More sharing options...
Jezza Posted February 1, 2010 Share Posted February 1, 2010 instead of using date("U") you can simply use time(); now, date has an optional second parameter, when you put in a timestamp it will use that instead of the current time, for example: $thetime=time(); $timelimit=$thetime-3600; $whatyouwant=date("h:i:s A",$timelimit); And that should tell you the time an hour ago hehe. see http://php.net/date for more info on the parameters and whatnot. Quote Link to comment https://forums.phpfreaks.com/topic/190519-working-with-date/#findComment-1005039 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.