Add hours to the opended_at field and display in a new field

Matt25
Giga Guru

Hi all, 

I hope this is an easy one to get solved,

Im after populating a field (u_cpc_date_time) with the time of '2 hours' after the opened_at time when a ticket is opened,

so...if a ticket was opened at 13:00, the 'u_cpc_date_time' field would display 15:00, im not sure if this is a business rule or a client script so any help would be great.

Thanks

Matt

 

1 ACCEPTED SOLUTION

Matt25
Giga Guru

Full solution,

var gdt = new GlideDateTime(current.opened_at);
gdt.addSeconds(7200);
current.u_cpc_date_time=gdt;

View solution in original post

7 REPLIES 7

Matt25
Giga Guru

Hi,

I figured it out, I changed the 

gdt.addHours(2);

to 

gdt.addSeconds(7200);

 

this is no populating correctly,

 

thanks for your answers,

Matt25
Giga Guru

Full solution,

var gdt = new GlideDateTime(current.opened_at);
gdt.addSeconds(7200);
current.u_cpc_date_time=gdt;

Cool, 

If I helped you in some way, please mark my response as helpful.

Thank you very much

Cheers
Alberto