skip to Main Content

Time between two dates in PHP

<?php $timezone='Asia/Tokyo'; $date_time_now = new DateTime('now', new DateTimeZone($timezone)); $date_time_now_formatted = $date_time_now->format('Y-m-d H:i:s'); echo $date_time_now_formatted . '<br>'; $UTC = new DateTime('now', new DateTimeZone('UTC')); $UTC_formatted = $UTC->format('Y-m-d H:i:s'); echo $UTC_formatted . '<br>'; $difference_seconds = $date_time_now->getTimestamp() - $UTC->getTimestamp(); echo $difference_seconds . ' <br>';…

VIEW QUESTION
Back To Top
Search