how to set Days,Hours,Minutes,Seconds of a Date/Time field
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 03:26 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2024 04:58 AM - edited 05-12-2024 04:59 AM
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