- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 02:25 AM
Hi,
I am scopped application we have a variable called Due date where i need to auto populate of next month
Example:
Today date: 8/3/2020
I need to set the default value as: 9/3/2020
In the default value when i use new GlideDateTime().getDisplayValue(); i am able to get the current data but i unable to add 1 month.
Can anyone please help me how to do this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 02:31 AM
Hi shaik,
You can use this in the default value: to add one month to the current date
javascript: var gdt = new GlideDateTime();gdt.addMonths(1);gdt.getDisplayValue();
You can also use addMonthsLocalTime() function to add months in local date.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 02:31 AM
Hi shaik,
You can use this in the default value: to add one month to the current date
javascript: var gdt = new GlideDateTime();gdt.addMonths(1);gdt.getDisplayValue();
You can also use addMonthsLocalTime() function to add months in local date.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2022 03:29 AM
with this condition can I exclude weekends(sat, sun)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2023 08:47 AM
Could you please share the condition for excluding weekends for the above code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 05:05 AM
Hi Irfan,
Try to add the code in default value in the dictionary of the field you are using.
1) If Field type= Date
javascript:var glideGD=new GlideDateTime();glideGD.addDays(30);glideGD.getDate();
2) If Field type= Date/Time
javascript:var glideGDT=new GlideDateTime();glideGDT.addMonths(1);glideGDT.getDisplayValue();
Please mark as Correct and Helpful if your issue was resolved with the solution provided.
Regards,
Subhojit Das