- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 06:35 AM
Hi,
ON NEW FORM when user selects DATETIME field(ex: start date), I need to convert it to UTC time in Client Script(or using GlideAjax)
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 07:58 AM
Hi,
Perhaps it's doing that because it's not saved to the database at that time. I see why you were specifically mentioning "new" record in your post. I didn't see that before.
With that said, you should be able to still use GlideAjax, onChange client script, for example, take that value from that field, send it to your script include and use that to "set the display value" of a GlideDateTime object, so not set the value, but set the display value of a GlideDateTime object.
Then...get the value, send it back to your client for use in your alert or whatever you need to do.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 07:58 AM
Hi,
Perhaps it's doing that because it's not saved to the database at that time. I see why you were specifically mentioning "new" record in your post. I didn't see that before.
With that said, you should be able to still use GlideAjax, onChange client script, for example, take that value from that field, send it to your script include and use that to "set the display value" of a GlideDateTime object, so not set the value, but set the display value of a GlideDateTime object.
Then...get the value, send it back to your client for use in your alert or whatever you need to do.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 08:02 AM
With that said, you should be able to still use GlideAjax, onChange client script, for example, take that value from that field, send it to your script include and use that to "set the display value" of a GlideDateTime object, so not set the value, but set the display value of a GlideDateTime object.
Sample code or JS method please...
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 08:32 AM
Hi Sandeep, Did you see my response? The first response to your question and using the 'getValue' method?
Thanks, Robbie
To help others, please mark correct and/or helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 08:35 AM
Yes I did try below
Passed start date to Glide Ajax(ex: "2022-04-29 08:00:00", this is in IST)
and in SI, i used below
var gdt = new GlideDateTime(startdate);
gs.print(gdt.getValue());
I return i am getting "2022-04-29 08:00:00"(same time, but i need in UTC)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2022 08:45 AM
Hi,
I appreciate you replying in my thread chain down here, but there is more to this than what you've posted above hence why I'm spending the time to reply down here.
We aren't necessarily saying the same thing.
Your response covers the very last step of a multi-step process.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!