Velocity adding years to a date token
I have a date field that I am pulling from a custom list, and I'm getting the date expected, but I want to take that date and add ten years to it. So I have the beginning date, and I want to create a field that shows the end date which is ten years after the opening.
I've not been able to figure out how to add the ten years. It feels like it should be relatively simple, but have not been successful.
#set( $dateOptions = {
"formats" : {
"userin" : "yyyy-MM-dd",
"userout" : "MMM d, yyyy"
},
"timezones" : {
"userin" : "America/Los_Angeles",
"userout" : "America/Los_Angeles"
},
"locale" : $date.getLocale()
} )
#set($myDate_formatted = "")
#foreach($customList in $account_cList)
#if($customList.productType == 3044 && !$customList.openDate.isEmpty())
#set($myDatelike = $customList.openDate)
#set($myDate = $convert.parseDate($myDatelike, $dateOptions.formats.userin, $dateOptions.locale, $date.getTimeZone().getTimeZone($dateOptions.timezones.userin)))
#set($myDate_formatted = $date.format($dateOptions.formats.userout, $myDate, $dateOptions.locale, $date.getTimeZone().getTimeZone($dateOptions.timezones.userout)))
#break
#end
#end
${myDate_formatted}
So for example, if the date read "May 26, 2015" it would return a result of "May, 26, 2025" I'm sure there are things like leap years that would need to be accounted for and perhaps complicate it a little bit, but it feels like it should be doable. What changes need to occur to get this to operate correctly?