How to get Local datetime on Function field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 01:49 AM
I created a function field that extracts only the date and time from the opened_at column as follows.
glidefunction:substring(opened_at, '12', '2')
However, the opened_at column is in UTC, I cannot obtain the correct value in the local datetime.
Is there a solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 02:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2025 10:34 PM
Thank you for your help.
I understand how to set the date in opened_at to local time in advance.
This may be one possible solution.
However, I would like to set the function field to local time for opened_at in records that were created in the past as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 02:12 AM
that's correct, it will give UTC time as system always store value in UTC.
try to use getDisplayValue() and see if that works, I am not sure if that works or not
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
08-03-2025 10:31 PM - edited 08-03-2025 10:35 PM
Thank you for your help.
I tried to use getDisplayValue(), but it was shown in the image below: