3414 views

Do not use gs.nowDateTime() in a GlideDateTime constructor



Description


To create a GlideDateTime object with the current date and time, do not provide a parameter. Simply call the constructor of the GlideDateTime class and the value is initialized to the current date and time.

// Do this

var gdt = new GlideDateTime();

Do not use gs.nowDateTime() to set a GlideDateTime object. The nowDateTime() method returns the date time in local format and the local time zone. The GlideDateTime object uses the date time in the internal format and UTC time zone.

//Not this

var gdt = new GlideDateTime(gs.nowDateTime());

 

Note: The gs.nowDateTime() method is not available in scoped applications.

 

Article Information

Last Updated:2016-06-08 15:01:42
Published:2016-06-03