Why add days not working when using glide date function?

KM SN
Tera Expert
var today = new GlideDate();
gs.print(today);
var tmrw = today.addDaysUTC(1);
gs.print(tmrw);

tmrw is printing as undefined? what might be the reason for this?
2 ACCEPTED SOLUTIONS

Voona Rohila
Tera Patron

Hi @KM SN 

Try this

var today = new GlideDate();
gs.print(today);
today.addDaysUTC(1);
gs.print(today);

 

addDaysUTC - Adds a specified number of days to the current object but doesn't return any value, so tmrw is showing as undefined

 

You can use the same object 'today' 

View solution in original post

Brad Bowman
Mega Patron

Most of the handy functions available in GlideDateTime are not in GlideDate.  Use GlideDateTime, then you can get just the date from that if you want.

View solution in original post

3 REPLIES 3

Voona Rohila
Tera Patron

Hi @KM SN 

Try this

var today = new GlideDate();
gs.print(today);
today.addDaysUTC(1);
gs.print(today);

 

addDaysUTC - Adds a specified number of days to the current object but doesn't return any value, so tmrw is showing as undefined

 

You can use the same object 'today' 

Brad Bowman
Mega Patron

Most of the handy functions available in GlideDateTime are not in GlideDate.  Use GlideDateTime, then you can get just the date from that if you want.