Get date/time format from REST
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 09:21 AM
Hi,
I've recently been able to grab all the information about the elements that build a table and theirs related types via REST so I have some 'date' fields with different types like:
- glide_date_time
- glide_time
- glide_duration
- etc
Is it possible to retrieve via REST which format they have ? I can assume that by default it is "yyyy-MM-dd hh:mm:ss" as SimpleDateFormat but of course one may decide to change it.
Thx
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2017 09:47 AM
Hello Luca,
You can grab the default date format (glide.sys.date_format) from the sys_properties table.
Each user can customize his or her date format. You can search a specific user's record for which format they have.
Here is more reading on the user preference http://wiki.servicenow.com/index.php?title=Using_Date_and_Time_Fields#User_Preferences
Cheers,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2017 02:56 AM
I see that there are info about:
- glide.sys.date_format
- glide.sys.time_format
But not for "datetime" so can I assume that such format is always:
${glide.sys.date_format} + ' ' + ${glide.sys.time_format}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2017 09:53 AM
Interesting assumption. I will have to look into it a bit more. That makes sense. I believe if you still created a GlideDateTime object in a script it would have to be the default format.
var gdt = new GlideDateTime("2011-01-01 12:00:00");
-Patrick