尝试使用 strtotime 将 mysql 时间戳转换为时间


Trying to convert mysql timestamp to time using strtotime

strtotime($_SESSION['starttime'])我尝试将存储为 $_SESSION['starttime'] 值的 mysql 时间转换为 1422094831,但我想使用 strtotime 将结果转换为时间,但没有返回任何值。可能出了什么问题?

> strtotime()用于创建时间戳,而不是将其转换为日期。如果您的会话变量存储时间戳,请尝试使用 date() 函数将其转换为更具可读性的格式。

echo date("Y-m-d", $yourTimestamp); //Will print YYYY-MM-DD format date

PHP 文档将帮助您正确使用date()函数。

如果这不是您想要做的,那么请在您的问题中提供更多信息,据我所知,您已经有一个时间戳。