How do you convert Glide Date object to a standard Javascript Date object?

Not applicable

Is there a way to convert a glide Date object to a javascript Date object?

I would like to convert a glide date object to milliseconds since 1970 (i.e. getTime)

DateTimeUtils has a function to convert ms to glide date - I need the inverse operation.

Thanks

3 REPLIES 3

john_roberts
Mega Guru

I'm working on the GlideDateTime wiki so stay tuned for details on the API. Until then...

The getNumericValue method will return millisecond value.



var gdt = new GlideDateTime();
gs.print(gdt.getNumericValue()); //same as new Date().getTime()


If you are accessing a GlideDateTime field remember that you need to get the full object.


var stringDateTimeValue = current.datetime_field;
var gdtObject = current.datetime_field.getGlideObject();


Thanks John. This is perfect! In fact, you helped answer a different question also. I didn't know about 'getGlideObject'!! Very useful.


Not applicable

-