我有 table 的行 ID、名称、created_at 并且我想在 php 中将 created_at 行作为时间戳输出
回答1
用 created_at
替换 time()
方法
$date = date("Y-m-d H:i:s", time());
这会帮助你吗? https://stackoverflow.com/questions/4834202/convert-time-in-hhmmss-format-to-seconds-only
...转换为秒
// example date from db
$created_at = "22-05-15 00:49:59";
$created = strtotime($created_at);
$current = strtotime("now");
$diff = $current - $created;
echo "Diff: " . $diff . " \n";