Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

GlideDateTime not returning expected value

IreneBest
Tera Contributor

I have created a notification email script to extract the date from a field.  I have defined this as follows:

 

var dateTime = new GlideDateTime(current.apt_start_time);

 

This returns the value 2023-11-09 02:30:00

 

The actual value of the field (Appointment start time: ${apt_start_time}) is:

 

09-11-2023 13:00

 

Actual script is as follows:

 

var dateTime = new GlideDateTime(current.apt_start_time);
    var time = dateTime.getTime();

    time = time.getByFormat('h:mma');
    time = time.toLowerCase();

    template.print(dateTime);
 
Any suggestions on what I am doing wrong?
0 REPLIES 0