- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2014 07:01 PM
In Client Script, how can I compare 2 dates(with time) that are in different format.
ex yyyy-mm-dd HH:mm:ss and MM-dd-yyyy hh:mm:ss (12 hours)
Somehow I need to convert the 2nd date&time to system format and then compare to the first date. But I do not know how. Please assist.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 06:55 AM
Using "getDisplayValue()" will retrieve the date/time in the person's timezone and display format. So you could use that on both date variables to force them into the same timezone.
gdate.getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 06:55 AM
Using "getDisplayValue()" will retrieve the date/time in the person's timezone and display format. So you could use that on both date variables to force them into the same timezone.
gdate.getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 06:56 AM
I use very similar code here with no problems. We are multi timezone too
this is one of the validation scripts checking the dates / times of the planned change
g_form.hideFieldMsg('end_date');
var dtStartForm = g_form.getValue('start_date');
var dtStart = getDateFromFormat(dtStartForm,g_user_date_time_format);
if (dtStartForm != '') {
var dtEndForm = g_form.getValue('end_date');
var dtEnd = getDateFromFormat(dtEndForm, g_user_date_time_format);
//g_form.addInfoMessage('Start Date : ' + dtStart + ' : End Date : ' + dtEnd);
if (dtEnd < dtStart) {
g_form.showFieldMsg('end_date', 'Planned end date cannot be before start date', 'error');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 07:13 AM
Thank you guys sooo much! This solved the issue!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 07:12 AM