MySQL Timestamp into PHP Format

Reply

Join Date: Dec 2004
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training

MySQL Timestamp into PHP Format

 
0
  #1
Mar 16th, 2008
I have a timestamp column in a mysql table.

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


Please help



Thanx
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 150
Reputation: sDJh is an unknown quantity at this point 
Solved Threads: 13
sDJh sDJh is offline Offline
Junior Poster

Re: MySQL Timestamp into PHP Format

 
0
  #2
Mar 17th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC