Convert Time into Zulu Format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 11:49 PM
Hi Team,
I want time in Zulu format, eg. 2022-05-31T07:34:45.968Z.
Can you please tell me if there's a function to implement it?
Thanks and Regards,
Hrithik Nirupam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 12:17 AM
Hi @Community Alums ,
Can you please try below code
var gdt = new GlideDateTime();
gdt.setTimeZone('Zulu');
gs.print(gdt);
This gives you time in Zulu time zone
Please feel free to ask any query
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 12:42 AM
Hi @Community Alums ,
Not sure in the GDT. The suggestion by @Community Alums delivers you the date/time without the T/Z and milliseconds.
You might consider using the plain javascript Date function instead of the GlideDateTime options:
var d = new Date();
gs.info(d.toISOString());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 01:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 02:05 AM
Hi @Community Alums ,
In which place wouldn't it work? Running it as background script works fine.
Creating a script include and calling it (from business rule and background script) works fine:
Script Include
As background script
Background Script
As display business rule
Business Rule
Display