uknowho008 Posted May 2, 2006 Share Posted May 2, 2006 this is probably a stupid question but how do i format a timestamp that im getting from a database to look like this?Mon, 1 May 2006 14:41:22 CETplease dont hurt me :D Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/ Share on other sites More sharing options...
AndyB Posted May 2, 2006 Share Posted May 2, 2006 [a href=\"http://ca.php.net/manual/en/function.date.php\" target=\"_blank\"]http://ca.php.net/manual/en/function.date.php[/a]Look at the options in the table that determine the precise manner in which the date/time are output. All you need is on that page. The example 4 should really help you. Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/#findComment-32516 Share on other sites More sharing options...
uknowho008 Posted May 2, 2006 Author Share Posted May 2, 2006 thanks but i cant figure out how to use a use a timestamp from the database instead of the current dateif my variable is $post_datehow would i format that? Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/#findComment-32522 Share on other sites More sharing options...
uknowho008 Posted May 2, 2006 Author Share Posted May 2, 2006 here is what im using to format the date$post_date = "20060420201649";$post_date = date("D, j M Y G:i:s T", $post_date);and this is what it outputs no matter what the $post_date isMon, 18 Jan 2038 22:14:07 ESTwhat am i doing wrong? i cant figure this out. Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/#findComment-32700 Share on other sites More sharing options...
kenrbnsn Posted May 2, 2006 Share Posted May 2, 2006 The date() function expects to see an integer containing the number of seconds since 1/1/1970, you are passing a string. How are you getting the value into $post_date?Ken Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/#findComment-32709 Share on other sites More sharing options...
uknowho008 Posted May 2, 2006 Author Share Posted May 2, 2006 im getting the value from the database. its set to timestamp. so how can i fix the problem? i dont really understand the seconds since 1/1/1970. thanks for the help. Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/#findComment-32712 Share on other sites More sharing options...
uknowho008 Posted May 3, 2006 Author Share Posted May 3, 2006 i know this shouldnt be that difficult. but i cant figure it out. can sombody help me out? paaaleeaasse? Link to comment https://forums.phpfreaks.com/topic/8861-quick-date-question/#findComment-33153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.