Date calculate based on selected time zone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 06:56 AM
Hi Everyone,
The instance is following IST time zone and all users profiles are also in IST time zone,
now based on schedule visit date time and time zone i need to calculate the date and time and populate in the field.
but it's not working expected.
script include:
----------------------------------------
------------
any suggestions pls.
Regards,
Rajesh
any suggestions pls.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 07:21 AM
what's your business requirement?
the 1st date/time has to be converted into which timezone and stored in 2nd?
But why
If users submitting are in IST then they can simply select IST time there?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 08:32 AM
hi @Ankur Bawiskar ,
Thanks for Reply....
My requirement is based on one Hour before schedule start i need to create a sctask, but instance is following IST timezone if user choose time zone as CST/PST etc., so in that case also it's to following IST only not user specified timezone in the form.
so that's why i am converting date& time based on timezone and based on the i need to create sctask.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 08:37 AM
if you are using flow then when flow runs it takes GMT time.
You can perform the calculation there and based on that 1 hr before the date selected you can create task
I created blog to convert date/time to different timezone, use that and enhance it as per your requirement
this converts UTC to IST for example
// for CST you can use CST in 1st parameter
var strConvertedDateTime = new GlideScheduleDateTime(new GlideDateTime()).convertTimeZone("UTC", "IST");
var gdtConvertedDateTime = new GlideDateTime(strConvertedDateTime)
gs.info(gdtConvertedDateTime);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 08:54 AM
Hi @Ankur Bawiskar ,
i don't have option to convert in flow ,
you saying , can i convert custom action to convert ?
Regards,
Rajesh