We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Date field is not setting properly through script include

MihirY
Tera Contributor

I am trying to update date time field in the project management task table. When I check the view xml of that record, date is showing as expected but when I see in the record value is coming different. I think issue towards the timezone but I am not able to identify fix. I want to set the date as 21st May but it is visible as 20th May.

MihirY_1-1736264355218.png

 

 

I am updating the record with below code

var endDate = new GlideDateTime(_date);
endDate.addDaysUTC(25);
gr.setValue("end_date",endDate); //assume here gr is already existed

 

2 REPLIES 2

Shruti
Giga Sage
var dt = "2025-05-20 20:00:00";
var tz = gs.getSession().getTimeZoneName();
var gdt = new GlideDateTime(dt.toString());
gdt.setTimeZone(tz);
var end_date = gdt.getDisplayValueInternal();
gs.info(end_date);

MihirY
Tera Contributor

I need to add the days to the date and need to set to end_date field. Your code doesn't match with that.