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.

Extract the date from GlideDateTime()

carlocsa
Kilo Expert

Hello Experts!

How do I extract or use the date from GlideDateTime()?

Thank you!

Carlo

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

Please try,



var sdt = new GlideDateTime();


var dt = sdt.getDisplayValue().split(' ')[0];


gs.print(dt);


View solution in original post

5 REPLIES 5

CataCamp
Kilo Contributor

This is what I have done:

 

var today = new GlideDate();

// formats to yyyy-mm-dd
var displayDate = today.getDisplayValue(); 

return displayDate;

 

CataCamp_0-1745597257577.png