'PHP code in Javascript not working on firefox [duplicate]
function getServerDateTime()
{
<?php
$timezone = 'America/Chicago';
$timestamp = time();
$dt = new DateTime("now", new DateTimeZone($timezone));
$dt->setTimestamp($timestamp);
$serverNow = $dt->format('m.d.Y H:i:s');
?>
let phpDate = "<?=$serverNow?>";
return new Date(phpDate);
}
function test()
{
let d = getServerDateTime()
}
I am trying to get the server date. It work on chrome but it won't even load on firefox.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
