How to return Date/Time field's value in milliseconds(epoch) in a business rule?

cc11
Tera Contributor

I am writing a business rule on incident table.

I want to print 'Created(sys_created_on)' field's value in milliseconds.

Looking for help.

Version - Jakarta

 

Thank you

1 ACCEPTED SOLUTION

Jon Barnes
Kilo Sage

you can get the number of ms since 1970-01-01 00:00:00 as an integer. is that what you are looking for?

var gdt = new GlideDateTime();
gdt.setValue(current.getValue('sys_created_on'));
var ms = gdt.getNumericValue();

 

View solution in original post

6 REPLIES 6

Is ServiceNow actually storing the millisecond value of any record creation or it is simply converting seconds to milliseconds by multiplying 1000?

CapaJC
ServiceNow Employee
ServiceNow Employee

Note that sys_updated_on is *stored* in the database with only second-precision, so the last three digits of that millisecond value will always be 000.