Get date/time format from REST

lucaburgazzoli
Mega Contributor

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

3 REPLIES 3

Patrick Fedigan
Giga Guru

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


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}




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