Get dateTime in seconds

Fabrizio Joaqui
Mega Guru
if I want the datetime in seconds it is correct to do so:

reqBodyPerson.dateOfBirth = new GlideDateTime(current.u_start_date_contract).getNumericValue();
 
1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hello,

Yes, this should work to convert date into epoch seconds.  If it's not working please try 

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

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

 

Regards,

Akshay

 

 

View solution in original post

1 REPLY 1

Community Alums
Not applicable

Hello,

Yes, this should work to convert date into epoch seconds.  If it's not working please try 

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

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

 

Regards,

Akshay