Quick timestamp formatting question....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Quick timestamp formatting question....

Post by Skittlewidth »

Its friday, my brain is frazzled and I can't figure this out:

I'm calling a timestamp(14) out of a mysql database (along with the rest of the contents of that table incase it makes a difference) and want to format it into a user friendly date.

I've tried using date("dmy", $row['test_date']) but it returned some date in January 2038 instead of the correct date which I presume is to do with seconds since the epoch instead.

Next I tried to format it as I selected it from the database in date_format('test_date', '%W %D %M %Y') but then I don't seem to be able to refer to it in the results array, not even as $row[0].

Its a linux server by the way.

Can anyone shed some light? It's supposed to be so simple!!!

My tired brain thanks you all in advance!
User avatar
Skittlewidth
Forum Contributor
Posts: 389
Joined: Wed Nov 06, 2002 9:18 am
Location: Kent, UK

Post by Skittlewidth »

Ha ha found the problem!

It was a lack of commas in the $row['0'] bit.
Never mind, only an hour till home time!!! :D :P
Post Reply