How to get current date and time based on users timezones
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2015 09:19 AM
Hi All,
In our instance my time zone is US Eastern so when I am getting any date and time field value it is giving in US eastern. But my systems time zone is India so when I used "new Date()" it is giving value in India's timezone. So I am not able to compare those two field values.Please see the below code I have written.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var stDate=new Date(getDateFromFormat(g_form.getValue('RequestedStartDate'),g_user_date_time_format));
var now = new Date();
//alert(stDate);
//alert(now);
if(stDate < now)
{
alert('System open time should be greater than or equal to current date and time');
g_form.clearValue('RequestedStartDate');
//return false;
}
}