Jump to content

Archived

This topic is now archived and is closed to further replies.

uknowho008

quick date question

Recommended Posts

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 CET


please dont hurt me :D

Share this post


Link to post
Share on other sites
[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.

Share this post


Link to post
Share on other sites
thanks but i cant figure out how to use a use a timestamp from the database instead of the current date

if my variable is $post_date

how would i format that?

Share this post


Link to post
Share on other sites
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 is

Mon, 18 Jan 2038 22:14:07 EST

what am i doing wrong? i cant figure this out.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
i know this shouldnt be that difficult. but i cant figure it out. can sombody help me out? paaaleeaasse?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.