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

Trying to convert mysql timestamp to time using strtotime

strtotime($_SESSION['starttime']) 我试图将存储为 $_SESSION['starttime'] 的 mysql 时间转换为值 1422094831,但我想使用 strtotime 将结果转换为时间,但 returns 没有值。有什么问题吗?

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

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

PHP doc 将帮助您正确使用 date() 功能。

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