
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 09:48 AM
I have a variable that is a date field. I want the date field to be 5 days out from the date the request was opened?
I've reviewed a SN Wiki article for Date/Time scripts, but after extensive reading of that article it didn't seem like any of the solutions worked so just trying to get some assistance.
Thanks,
Karen
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 10:55 AM
Karen,
The script should be:
var today = new Date();
var dateMS = today.getTime();
dateMS = dateMS + (5*24*60*60*1000);
var newDT = new Date();
newDT.setTime(dateMS);
g_form.setValue('ftr_needed_by',formatDate(newDT,g_user_date_format));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 10:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 10:55 AM
Karen,
The script should be:
var today = new Date();
var dateMS = today.getTime();
dateMS = dateMS + (5*24*60*60*1000);
var newDT = new Date();
newDT.setTime(dateMS);
g_form.setValue('ftr_needed_by',formatDate(newDT,g_user_date_format));

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 11:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 11:20 AM
Please fix this from your code:
g_form.setValue('ftr_needed_by',formatDate(newDT,g_user_date_format)); in quotes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 11:24 AM
This was perfect. I forgot to include the quotes around my variable name.
Much appreciated Rahuljain and Mani