954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

MySQL Timestamp into PHP Format

I have a timestamp column in a mysql table.

Using PHP, how do I convert the timestamp format which is "YYYY-MM-DD HH:MM:SS" into a format like "March 16 2008, 08:41 am" ?


Please help

Thanx

cancer10
Posting Whiz in Training
234 posts since Dec 2004
Reputation Points: 58
Solved Threads: 1
 

basically there are two ways of solving it. The first is the explode the data into chunks and then converting them.

secondy, in my opinion the better and easier way:
use the function date("prefered format",mktime(...))
first arguments is you format that you like.
the secend argument created an unix-timestamp (look at http://de2.php.net/manual/en/function.mktime.php) . it allows you to generate any date and time you like.

sDJh
Posting Whiz in Training
259 posts since Aug 2005
Reputation Points: 56
Solved Threads: 29
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You