- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 03:52 PM
Can anyone help me with the script to get the time in the user's timezone?
var gt = new GlideDateTime();
var gdt = gr.getTime();
gs.print(gdt.getDisplayValue());
The script above is displaying with an error of (-1) hour.
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 04:07 PM
Use below if you just need time
var gt = new GlideDateTime();
gs.print(gt.getDisplayValue().split(' ')[1]);
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 04:02 PM
Below should work
var gt = new GlideDateTime();
gs.print(gt.getDisplayValue());
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 04:04 PM
Yes it displays the date and time. Think I will have to parse out the time from it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2017 04:07 PM
Use below if you just need time
var gt = new GlideDateTime();
gs.print(gt.getDisplayValue().split(' ')[1]);
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 06:14 AM
It there a recommended way to include AM/PM on the split?
Currently it includes only the time, I'm using it on a time field and need am/pm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2017 06:23 AM
var gt = new GlideDateTime();
var time = gt.getDisplayValue().split('')[2];
The one above gives AM/PM