Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to add hours to a date/time field

Alon Grod
Tera Expert

Hi,

I have the field u_future_date of type Date/Time and I have on before BR that execute on certain conditions. The BR need to take the current.u_future_date and add to it 2 hours. How can I achieve that?

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron

Hi,

Try something like this

 

var gdt = new GlideDateTime(current.u_future_date ); //use your field here
var hours = 60*60*2;  
gdt.addSeconds(hours);
gs.log(gdt.getDisplayValue()):

 

-Anurag

View solution in original post

1 REPLY 1

Anurag Tripathi
Mega Patron

Hi,

Try something like this

 

var gdt = new GlideDateTime(current.u_future_date ); //use your field here
var hours = 60*60*2;  
gdt.addSeconds(hours);
gs.log(gdt.getDisplayValue()):

 

-Anurag