hello,
i have a mySQL database with a timestamp to record when a user submits a comment.
How can I change this to "Thursday, 21st January 2008"PHP Code:$Date = $row[date];
when used in this case:
PHP Code:echo ("$Date");
Thanks for your help!
hello,
i have a mySQL database with a timestamp to record when a user submits a comment.
How can I change this to "Thursday, 21st January 2008"PHP Code:$Date = $row[date];
when used in this case:
PHP Code:echo ("$Date");
Thanks for your help!
more infoPHP Code:$date_out = date('l jS F Y', $Date);
Thanks, I thought that too, but it doesnt work! it keeps using the default date of:
I have no idea why!Code:Thursday 1st January 1970
Apache version 2.2.9 (Unix)
PHP version 5.2.6
MySQL version 4.1.22-standard
That's because$Datecontains the value0.
nope, because if Ii get the value 2008-11-28 09:43:27PHP Code:echo ("$Date");
here's the full code:Of which, the output is:PHP Code:$Date = $row[date];
$date_out = date('l jS F Y', $Date);
echo ("$date_out");
echo ("$Date");
Code:Thursday 1st January 1970 2008-11-28 09:43:27
Use strtotime() to convert the date being returned from the sql query to a unix timestamp and then pass that value to the date function as mentioned before.
Hope this helps.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Well
is NOT a timestamp.Code:Thursday 1st January 1970 2008-11-28 09:43:27
Bookmarks