开发者

Formatting MySQL timestamp to PHP DateTime

开发者 https://www.devze.com 2023-03-10 10:01 出处:网络
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 t

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

精彩评论

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

关注公众号