How to get today date in SANDBOX using client script? I tried the below things but
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 11:57 AM
Hi,
I am new to Servicenow
var today=new Date(); //by using these gives output as UTC form date and time, so i am unable to macth this date with my input whatever i gave in the form
var a= now();
var b=nowDateTime();
var right_now=g_form_Date_Time;
and also i tried Glide System, Ajax and some other things . Glide System(gs) and Current does not supported by SANDBOX...
and tried few more things but i am not able to find???
My question is i want to accept the Date of Birth of a person with past and present date only (current date) it will not accept the future date.....
Can anyone Guide me....
Thanks in Advance...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 12:05 PM
var today = new GlideDateTime();
var dob = g_form.getValue('date_of_birth');
if (dob > today)){
g_form.showErrorBox("date_of_birth", "You are not allowed to have a date of birth blah blah blah");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 12:14 PM
Hello Mike Allen,
Rightnow i am practicing in SANDBOX.. it will not support GlideDateTime... Already tired this one... i checked with Alert, Its not working..
Thanks
Anyother way?????
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 12:20 PM
What if you add a today.addHours to your script to simulate the right time zone?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 12:21 PM
Are you using in client script or business rule. Alert will not work in business rule, for BR please gs.log starement and check log table.
Sent via the Samsung GALAXY S ® 5, an AT&T 4G LTE smartphone