开发者

Formatting MySQL timestamp to PHP DateTime

How can I forma开发者_Python百科t a timestamp from MySQL to a date value in PHP?


Formatting and storing of a date can be perfectly seperated. Use strotime and strftime to calculate timestamps and use those with date.

In your view:

date('F d, Y at g a', strtotime($storedDate));

Wherever you store your date

date('Y-m-d H:i:s', strtotime($formattedData));


echo date('r', strtotime($mysql_datetime_column_value));

See the date() function in the PHP documentation for more detail.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜