Convert "Mon Feb 24 2025 05:17:41 GMT-0800 (PST)" to "Mon Feb 24 2025 05:17:41 GMT-0800 (CST/IST)"

chatsaurav19
Tera Contributor

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

3 REPLIES 3

Martin Friedel
Mega Sage

Hello, 

 

check there releated Community articles:

If my answer helped you, please accept it as correct and mark helpful, thank you 👍
Martin

Melwin Arulappa
Tera Contributor

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());

Melwin Arulappa
Tera Contributor

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());