Covert numeric value to date. Example : 1092715200

K P
Kilo Explorer

I am working with migration from remedy and i am getting numeric value for date in excel. So i want to convert that number into date for servicenow.

1 REPLY 1

Community Alums
Not applicable

That's the number of seconds since the epoch (1/1/1970), so the example you've given is 17 Aug 2004 04:00:00 GMT. 

Here's a function to help you out:

var demo = secondsToDate(1092715200)

function secondsToDate(sec){
   var gdt = new GlideDateTime("1970-01-01 00:00:00");
   gdt.addSeconds(sec)
   return gdt
}

 

a gs.info on demo would return: 

2004-08-17 04:00:00