how to set Days,Hours,Minutes,Seconds of a Date/Time field

Shir Sharvit
Tera Contributor

Hi,

I have the field u_date of type Date/Time.

How can I add days to this field and set the hours,minutes, and second to what I want.
For example:

u_date = 12/05/2024 15:00:00

add 2 days, set hours, minutes and seconds to: 16:30:22

u_date =  14/05/2024 16:30:22

 

thank, Shir

5 REPLIES 5

Community Alums
Not applicable

Hi @Shir Sharvit ,

Please try below code this will work for you 

 

var dt = new GlideDateTime('u_date'); // current.u_date if using in BR
dt.addDays(2);
gs.print(dt);

 

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak