Changing javascript date/time to server date/time using php

Simple way to change JavaScript date/time to server date/time, first we are going to pass php date format into javascript date function. <script language="javascript"> var serverDate = new Date("<?php echo date("Y/m/d");?>"); var systemDate = new Date(); function currentDateTime() { document.getElementById("divCurrentSYSTEMDate").innerHTML = systemDate; document.getElementById("divCurrentSERVERDate").innerHTML = serverDate; } </script>