GlideDateTime incorrect Date

Edwin Fuller
Tera Guru

I'm using the below script to set a date field called "Actual Completion Date". I believe the GlideDateTime is using a different time zone then the time zone it should be which is Central. Sometimes the field gets set to the current day which is correct and then other times the field is set to the next day which is incorrect. Any thought on this?

var gdt= new GlideDateTime();

current.actual_completion_date.setValue(gdt);

current.current_status = ('Complete');

current.update();

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

If it is a date type field, try this




var gdt= new GlideDateTime();


current.actual_completion_date=gdt.getLocalDate();


current.current_status = ('Complete');


current.update();


View solution in original post

3 REPLIES 3

Abhinay Erra
Giga Sage

Try this



var gdt= new GlideDateTime();


current.actual_completion_date=gdt.getValue()


current.current_status = ('Complete');


current.update();


Abhinay Erra
Giga Sage

If it is a date type field, try this




var gdt= new GlideDateTime();


current.actual_completion_date=gdt.getLocalDate();


current.current_status = ('Complete');


current.update();


Thank you, this worked for me!!