Skip to main content
Skip table of contents

Date

A Date value represents a specific date. It contains the year, month and day, any of which can be accessed separately if needed. Its methods also allow creation of new Date values derived from the base value, such as using ${today.plusDays(30)} to create a Date that is 30 days in the future of the Date called "today".  

Related commands

  • setDate
    Allows new Date values to be created within the logic, such as very easy creation of the date on which the logic is being run.

  • setDateFormat
    Used for creating Date formats that allow wide customization of how Date values are converted into Strings to be displayed on document.

  • setDateParser
    A Date parser created by this command can be used to convert Strings into Dates.

Methods

getDayOfYear() / getDayOfMonth() / getDayOfWeek()

These three methods resolve into a Number telling the day of this Date in different contexts.

For example, the expression ${today.getDayOfMonth() == 1} resolves into true if 'today 'represents the first day of its month.

Using the shorthand form the expression becomes ${today.dayOfMonth == 1}.

getYear() / getMonthOfYear()

These two methods resolve into a Number representing the year / month of the Date.

For example, the expression  ${today.getYear() >= 2000} resolves into true if 'today' is on year 2000 or later.

Using the shorthand form the expression becomes ${today.year >= 2000}.

minusYears(value) / minusMonths(value) / minusWeeks(value) / minusDays(value)

A set of methods that resolve into a new Date that is this Date but with the specified number of years/months/weeks/days earlier in time.

For example, the expression  ${anniversary.minusDays(30)} resolves into a Date that is about one month earlier than 'anniversary'.

plusYears(value) / plusMonths(value) / plusWeeks(value) / plusDays(value)

A set of methods that resolve into a new Date that is this Date but with the specified number of years/months/weeks/days later in time.

For example, the expression ${startDate.plusMonths(2)} resolves into a Date that is two months later than 'startDate'.  

withYear(value) / withMonth(value) / withDay(value)

A set of methods that resolve into a new Date that is this Date but with the year/month/day set to the specified number.

For example, the expression  ${closeDate.withMonth(7)} resolves into a Date that has the same year and day as 'closeDate', but has its month set to 7 (July).

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.