function getCurrentDateTime() { var currentDate = new Date(); var currentYear = currentDate.getFullYear(); var currentMonth = currentDate.getMonth() + 1; var currentDay = currentDate.getDate(); if (currentDay < 10) currentDay = '0' + currentDay; if (currentMonth < 10) currentMonth = '0' + currentMonth; var todayDate = currentMonth + '/' + currentDay + '/' + currentYear; return todayDate; }
I have written the following method to fetch current time in javascript. but this is giving me browser time,i want server time. how to get server side time in javascript,please do let me know about the same. stuck on this.