- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2020 11:16 PM
Hello,
We have 2 fields in a form.
1. Expected Start Date/Time
2. Expected End Date/Time
The above 2 fields show the system date/time.
I want 2 more fields below below the above mentioned fields with name :
1. Expected Start Date/Time (EST)
2. Expected End Date/Time (EST)
Requirement :
Expected Start Date/Time (EST) will be copied from Expected Start Date/Time once the user fill this field and show EST time.
Expected End Date/Time (EST) will be copied from Expected End Date/Time once the user fill this field and show EST time.
Can someone please help in how to achieve this functionality?
NOTE : The fields are in scoped application.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:57 PM
Okay.
Hi create a SI in global scope and then call that Si from your client script. Then you can use the following code to convert your date/time to EST format.
Script Include
getConvertedDate: function() {
var mydate = new GlideDateTime(this.getParameter('sysparm_date').toString());
var gdt1 = new GlideDateTime();
//sets to EST
var tz = Packages.java.util.TimeZone.getTimeZone("EST");
gdt1.setTZ(tz);
gdt1.setValue(mydate);
return gdt1.getDisplayValue(); //returns the date/time in EST timezone as a string.
},
Mark the comment as a correct answer and also helpful if this helps to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:27 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2021 11:57 PM
Okay.
Hi create a SI in global scope and then call that Si from your client script. Then you can use the following code to convert your date/time to EST format.
Script Include
getConvertedDate: function() {
var mydate = new GlideDateTime(this.getParameter('sysparm_date').toString());
var gdt1 = new GlideDateTime();
//sets to EST
var tz = Packages.java.util.TimeZone.getTimeZone("EST");
gdt1.setTZ(tz);
gdt1.setValue(mydate);
return gdt1.getDisplayValue(); //returns the date/time in EST timezone as a string.
},
Mark the comment as a correct answer and also helpful if this helps to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:26 AM
Hi Asif,
I have created new Script Include which you have mentioned in global application and de-activated my all SI which I created earlier and calling it from my client script.
Script Include :
Client Script :
Now, no value is getting populated in 'expected_start_date_time_est'.
NOTE : I have de-activated my script includes 'ClientTimeZoneUtils' and 'TimeZoneUtils'.
Kindly let me know where I am going wrong?
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:36 AM
Hi,
Here are corrections
1. Line 8 pass the right Si function name. As per SI the function anme is getConvertedDate.
2. Line 9, In your cleint script you are passing variable a in quotes, which should not be. Pass the variable a without quotes.
After making these changes , test agian. If does not work, add alert after line 13 and check what is the value of variable answer
alert(answer);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 01:16 AM
Hi Asif,
It worked. Thanks all for your valuable time and help.
Thanks.