Question about MySQL timestamp

They have: 141 posts

Joined: Aug 1999

OK guys, when I query a timestame field from a database, it gives me a long number. Is there a php function that could change that to a readable format? Date() only works for unix timestamps.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I played with the mySQL timestamp breifly. Didn't get the results I wanted, so I've used INT(11) ever since.

...just did a search at mysql.com and got these:
http://www.mysql.com/doc/D/a/Date_and_time_functions.html
http://www.mysql.com/doc/D/A/DATETIME.html

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 141 posts

Joined: Aug 1999

MySQL has a functin unix_timestamp() that will convert it into a unix timestamp.

That solved my problem, so now I can use built in sql time seaching functions and get unix timestamps for php's date() formatting function.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

wooohh kuel!
I may have to go back and convert some of those table now Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.