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;	

Now we are going to call currentDateTime function inside the body, which will display the current system and server date/time.

Current SYSTEM date/time <div id="divCurrentSYSTEMDate"></div><br /><br />
Current SERVER date/time <div id="divCurrentSERVERDate"></div><br /><br />


[ Download ] | [ Demo ]