如何将 MySQL 中的时间戳格式化为 PHP 中的日期值?
最佳答案
日期的格式化和存储可以完全分开。使用 strotime
和 strftime
计算时间戳并将其与 date
一起使用。
您认为:
date('F d, Y at g a', strtotime($storedDate));
无论您在何处存储日期
date('Y-m-d H:i:s', strtotime($formattedData));
关于php - 将 MySQL 时间戳格式化为 PHP DateTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6228380/