- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2018 06:58 PM
Hi,
I have 4 fields on my change form that needs to be shown UTC time zone; I have gone through majority of the community threads, but couldn't find the solid answer for my request. Please advise.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 03:40 AM
Hi Eliana,
If you define a column with the type of "Date", the system will stores value only in UTC. While displaying the value will get converted from UTC to User timezone. If you want to display the value in UTC irrespective of User Timezone, define the column with the type of "String" and store the value in UTC. The String type values will not get converted. It will get displayed as it is.
Use this command to get the current time in UTC
gs.nowNoTZ()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2018 07:16 PM
I believe you should be able to do with getValue()
GlideDateTime - getValue()
Returns the date and time value stored by the GlideDateTime object in the internal format, yyyy-MM-dd HH:mm:ss, and the system time zone, UTC by default.
var gdt = new GlideDateTime();
gs.print(gdt.getValue());
Output: 2018-02-14 03:15:44
Please share your code, how are you trying to do for more clarity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2018 07:46 PM
or you can check: JavaScript toUTCString() Method , but this will give date which will be in below format. like
Fri Mar 25 2015 09:56:24
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2018 08:23 PM
Hi Shishir,
Thanks for your reply, I went through the article; I will try to see if I can apply the mentioned script in my BR.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2018 07:45 PM
Eliana - I am not pretty sure what's you business case but you need to set the display value of that 4 field.
to convert use
var d = new Date();
var n = d.toUTCString();
n is your value.