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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2011 08:36 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2011 09:24 AM
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();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2011 10:44 AM
Thanks John. This is perfect! In fact, you helped answer a different question also. I didn't know about 'getGlideObject'!! Very useful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2011 10:43 AM
-