How servicenow store the date and time at db level

pratapdalai
Tera Contributor

HI All,

 

Please let me know how ServiceNow store the value at database level and also please let me know about the what is this date format.

 

20230926T050000Z 

8 REPLIES 8

Peter Bodelier
Giga Sage

Hi @pratapdalai 

 

Why do you need to know how it is stored?
As long as you use GlideDateTime API, it really doesn't matter.

 

The string 20230926T050000Z is a date and time representation in the ISO 8601 format. It consists of the following parts:

20230926 is the date in the YYYYMMDD format, which means September 26, 2023.
T is a separator between the date and time components.
050000 is the time in the HHMMSS format, which means 5:00:00 (5 hours, 0 minutes, and 0 seconds).
Z is a suffix that indicates the time zone is UTC (Coordinated Universal Time), which is equivalent to GMT (Greenwich Mean Time).
Therefore, 20230926T050000Z means September 26, 2023 at 5:00:00 UTC.

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Thank You,

Could you please tell me how to do the comparison between two ISO format date and time  values  

 

for example 20230926T050000Z     

  20230926T060000Z

Hi @pratapdalai,

 

Convert it to GlideDateTime object.

var start = new GlideDateTime("20230926T050000Z");
var end = new GlideDateTime("20230926T060000Z");

var dur = GlideDateTime.subtract(start , end ); // Difference between start and end 
gs.info(dur.getDisplayValue());

 

Please check GlideDateTime | ServiceNow Developers 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

I have a table which has two column StartDate and EndDate,both ha the value in ISO Date and Time format.

 

What i am trying to achieve  here to find on records based  inputstartdate and inputdateend time value.i.e my inputstartdate > StartDate  AND EndDate <inputdateend.

 

Please all values are in ISO date time format