Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

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
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
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