I am trying to get current server date-time in javascript. So I am passing php date timestamp to javascript date function but I am getting one day difference in date of javascript. Below is my code:
function showRemaining() {
<?php
$current_date = date("m/d/y H:i:s");
$date = strtotime($current_date) * 1000;
?>
alert('<?php echo $current_date;?>'); //alerts 12/04/15 05:42:14
var now = new Date(<?php echo $date;?>);
alert(now); //alerts Thu Dec 03 2015 21:42:14 GMT-0800 (Pacific Standard Time)
}
I want it to display today's date i.e Dec 4 .