Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: 「数時間前」のトラブルまでの PHP タイムスタンプ
数時間前までの時間を表示する PHP タイムスタンプを作成するにはどうすればよいですか? たとえば、2 日前ではなく 48 時間、20 日前ではなく 480 時間を表示します。
$dateposted = '2012-12-1 12:59:44'; $dateposted2 = '1354661156'; // time(); echo ceil((strtotime("now") - strtotime($dateposted))/3600); echo ceil((strtotime("now") - $dateposted2)/3600);