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 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 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 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. Link to comment https://forums.phpfreaks.com/topic/190519-working-with-date/#findComment-1005039 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.