php - mysql timestamp convertion -


What is the correct way to choose your own from the MySQL timestamp (YYYY-MM-DD HH: MM: SS) Something like the format, "5 August 2010"? How can I do mysql timestamp php date () compatible?

There are two ways ...

First of all, do it in PHP Can ...

  $ time = strtotime ('2010-05-05 05:05:05'); Echo date ('FJ, Y', $ time); Or, you can convert it to MySQL in Unix time:  
  SELECT UNIX_TIMESTAMP (`your timestamp column ') blahblah ... .  

After you bring it, it will need to be formatted in date () .

Or, you can do the whole thing right with MySQL:

  SELECT DATE_FORMAT (`your timestamp column ','% M% e,% Y ') FROM ...  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -