withYear
Syntax
$calendar.withYear($year)
Description
Creates a new calendar from the given calendar, setting the year to year
. Changing the year can also change other values such as the day of the week.
Parameters
Name | Type | Description | Mandatory | Default |
---|---|---|---|---|
calendar | Business object | The calendar whose year is to be changed. It can be a system or user calendar. | yes | |
year | Number | Value for the new year to be set for the calendar. | yes |
Return value
Type: Business object
A calendar with the changed value for the year.
Examples
date(2012, 8, 15).toUserCalendar().withYear(2021).year()
Output: 2021