Time conversion to 24hr format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2020 07:15 AM
Hi,
I was asked to write a script to convert CST time to GMT time. I developed that successfully but now i am asked to convert 12 hour format to 24 hour format in same script. Can you please suggest what changes i can do to achieve this in below script.
var tz = Packages.java.util.TimeZone.getTimeZone("GMT");
var sd = new GlideDateTime();
sd.setTZ(tz);
sd.setValue(current.start_date);
variable.inputs.planned_start_date = sd.getDisplayValue().toString();
var ed = new GlideDateTime();
ed.setTZ(tz);
ed.setValue(current.end_date);
variable.inputs.planned_end_date = ed.getDisplayValue().toString();
ServiceNow Community Rising Star 2022/2023
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2025 10:24 PM
Hi @JagjeetSingh can you pls accept the solution if you found it helpful so that it helps others in the community also ? Thanks