PHP date to JS date

Kako pouzdano iz PHP-a setapirati JS date

$tz = new DateTimeZone($this_city_tz);
$date = new DateTime();
$date->setTimeZone($tz);
$date_time = $date->format('Y-m-d H:i:s');
$date_time_js = $date->format('Y/m/d H:i:s');

var currentDate = new Date('<?php echo gmdate("r", strtotime($date_time_js)); ?>');

console.log(currentDate);

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.