how to add hours to start date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 02:38 AM
Hi All,
i have a start date :2020-02-19 04:57:49 how to add 12 hours to this date as gs.hoursAgo() adding hour to system date. Please help
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 02:41 AM
Hi Shilpi,
Kindly use this piece of code:
var gdt = new GlideDateTime();
gdt.setDisplayValue(current.start_date.getDisplayValue());
gdt.addSeconds(43200); //add 12 hour (can do for more by multiplying with 3600 factor)
var result=gdt.getDisplayValue(); //this will get you the new glideDatetime
Regards,
Munender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 02:43 AM
var gdt = new GlideDateTime(current.start_date);
var hours = 60*60*12;
gdt.addSeconds(hours);
gs.log(gdt.getDisplayValue()):

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2020 03:50 AM
check out this link for more clarification: