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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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.