How to add five minutes to a date time field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2011 09:09 AM
We have created a date time field on our requested item form called LP Loan Docs Due date and Time. Our customer wants us to add five minutes to this field (for example if the current date time is 2011-07-28 12:00:00, they would like it to show as 2011-07-28 12:05:00).
Is there a way to accomplish this in a business rule?
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2011 09:51 AM
var dte = current.date.getGlideObject();
//5 mins * 60 seconds = 300
current.date = dte.addSeconds(300);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2015 01:56 PM
Shane, I am indebted to you! I've been experimenting (trial and error) at least 50 times trying to get a field with a time which is 10 minutes after the start time. There is only one thing about your post. When I tried the last line as
current.date = dte.addSeconds(300);
I ended up with an undefuned value in current.date.
When I just used
dte.addSeconds(300);
It worked! current.date had a time which was 5 minutes later than the initial value.
Of course, my code is in a producer script and is a little different than yours.
Here's the pertinent lines in case you can see anything significant:
current.end_date = producer.scheduled_date_time;
var end_dt = current.end_date.getGlideObject();
end_dt.addSeconds(600);
Once again, I appreciate your advice as it put me on the right track! Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2015 04:12 AM
Hi shane,
I want to autopopulate my due_date field with the priorities calculation.DUE_DATE value should be recalculated at creation time and after any customer visible update.
like for priority p0 and p1,i want my field to add 10' to it
for p2, 8h to it