- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I would like the date and time to be converted in Scoped application below code is not working can you please help me.
The above Incident record created on the 2026-04-07 21:15:06 and output I am getting is Incident opened time in CET: 2026-04-07 19:15:06 (Actually it should be 17:45:06)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
this works in scoped app
var strConvertedDateTime = new GlideScheduleDateTime(new GlideDateTime()).convertTimeZone("UTC", "IST");
var gdtConvertedDateTime = new GlideDateTime(strConvertedDateTime)
gs.info("Converted Time: "+gdtConvertedDateTime);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
this works in scoped app
var strConvertedDateTime = new GlideScheduleDateTime(new GlideDateTime()).convertTimeZone("UTC", "IST");
var gdtConvertedDateTime = new GlideDateTime(strConvertedDateTime)
gs.info("Converted Time: "+gdtConvertedDateTime);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Ankur,
The above code is working fine but now the issue when I try to return multiple values then time zone is not converting.
Description and date: Then time is not converting. (2026-04-08 08:25:16Hello)
var strConvertedDateTime = new GlideScheduleDateTime(new GlideDateTime(non_CET)).convertTimeZone("UTC", "CET");
var gdtConvertedDateTime = new GlideDateTime(strConvertedDateTime);
return gdtConvertedDateTime;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Glad to know that my script worked fine for you.
Would you mind marking my response as correct and close the thread?
The discussion can continue on closed thread as well.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
what debugging did you do?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar ,
Instead of hardcoded I tried to return the data through the script. Now I am trying to update the field and then call the field in message variable..
Thanks,
Sai.
