Convert "Mon Feb 24 2025 05:17:41 GMT-0800 (PST)" to "Mon Feb 24 2025 05:17:41 GMT-0800 (CST/IST)"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 05:23 AM
Hi All,
Can someone please help me change the the format of the below date from PST to CST format?
Mon Feb 24 2025 05:17:41 GMT-0800 (PST) to Mon Feb 24 2025 05:17:41 GMT-0800 (CST or IST)
I tried multiple options but it isn't working. As an example -
var lastWorkingDay = new Date(today);
var s = new Date(lastWorkingDay).toLocaleString(undefined, {timeZone: 'Asia/Kolkata'});
gs.info(s); //not working
var date = new Date(lastWorkingDay);
gs.info(date.toString()); //not working
Regards,
Saurabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 05:28 AM - edited 02-24-2025 05:28 AM
Hello,
check there releated Community articles:
If my answer helped you, please accept it as correct and mark helpful, thank you 👍
Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 12:00 AM
Hi @chatsaurav19
Try below code
var pstDateTime = "2025-02-24 05:17:41";
var gdt = new GlideDateTime(pstDateTime);
gdt.addSeconds(2 * 3600); // Convert from PST to CST
gs.info("CST Time: " + gdt.getDisplayValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 12:02 AM
Try below code
var pstDateTime = "2025-02-24 05:17:41";
var gdt = new GlideDateTime(pstDateTime);
gdt.addSeconds(2 * 3600); // Convert from PST to CST
gs.info("CST Time: " + gdt.getDisplayValue());