Add 1 year to current date in date field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2015 02:57 PM
I have a date field where I am currently setting the defualt value to todays date using javascript:now();. I am unable to figure out how to set the defualt value to todays date + 1 year....
Can someone please help me with this?
- 12,652 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2015 04:21 PM
Use this:
javascript:var gdt = new GlideDateTime(gs.nowDateTime());gdt.addYears(1);gdt.getDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2015 08:36 PM
Additional: we should use addYearsLocalTime instead of addYears since Eureka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2017 05:36 AM
I have a created a feild and trying to add 1year to the current date.
Still not populating
function execute() {
var newDate = new GlideDateTime();
newDate.addyears(1);
current.u_annual_review = newDate.getDate();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2015 07:25 PM