View Full Version : Coverting timestamp to day date ?

03-15-2009, 04:48 PM
How do I convert my time stamp that is saved
in my database as a number : "1235291592"
back into a day and date
eg Thursday, 12 March 2009.

BTW did anything special happen at the magic time of
"1234567890" ? I would have thought some geeks had a
sort of new years eve party ?

Thanks for any help on this

03-15-2009, 04:59 PM
print date('l, j F Y','1235291592');

03-15-2009, 05:52 PM
Thanks Dave,

I tried that and I got this error:

Warning: date() expects parameter 2 to be long, string given in /home/guru54gt5/public_html/new_members.php on line 57

This is the code I used:

while($row = mysql_fetch_assoc($result)){
$join_dt = date('l, j F Y','$create_date');
echo "<div class=\"listerdiv\">
<span class= \"lk\">$Rctr ) $user_id, $contact, Join date: $join_dt </span>

The "create_date" field is defined in the table as:
`create_date` int(12) default NULL,

Have I done something wrong ?

03-15-2009, 05:55 PM
Remove the single-quotes around the second parameter so it will be a number instead of a quoted string. And in fact, php variables are not parsed when inside single-quotes so, '$create_date' returns the string $create_date and not the value in that variable.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum