
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 05:09 PM
I need to get the custom formatted display value of a date/time field, but I would like to do it with one GlideDateTime object and not have to feed one to the other as shown below. Let me know if you know of a better way.
This only seems to return the UTC value
var gdt = new GlideDateTime();
gs.info(gdt.getTime().getByFormat('hh:mm:ss a'));
This is the only way I have found to return the display value, is there a better way?
var gdt = new GlideDateTime();
var hack = new GlideDateTime(gdt.getDisplayValue());
gs.info(hack.getTime().getByFormat('hh:mm:ss a'));
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- 26,010 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 05:17 PM
I think this would work:
gs.info((new GlideDateTime()).getLocalTime().getByFormat('hh:mm:ss a'));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 05:17 PM
I think this would work:
gs.info((new GlideDateTime()).getLocalTime().getByFormat('hh:mm:ss a'));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 05:58 PM
Thanks Jonathan, I completely forgot about the getLocal methods.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2017 02:01 PM
Hi Jonathan,
I am trying of print the highlighted field (its getting updated by BR as per additional comments update) as per User Location. Although I get correct time on Field (EST) , however I still get System Timezone (PST) on the Notification.
Please advise!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2017 04:44 PM
This should work for you:
template.print("Additional Comments given at : " + (new GlideDateTime(abc)).getDate().getByFormat('dd/MM/yyyy'));