Contact Free trial Login

isLeapYear

isLeapYear(DateTime): Boolean

Returns true if it receives a DateTime for a leap year, false if not.

Parameters

Name Description

dateTime

The date-time (DateTime type) to evaluate.

Example

This example indicates whether the input is a leap year.

Source

%dw 2.0
output application/json
---
{
  "leapYear" : isLeapYear(|2016-10-01T23:57:59Z|),
  "leapYear" : isLeapYear(|2016-10-01T23:57:59-03:00|),
  "leapYear": isLeapYear(|2017-10-01T23:57:59Z|),
  "leapYear": isLeapYear(|2017-10-01T23:57:59-03:00|)
}

Output

  {
    "leapYear": true,
    "leapYear": true,
    "leapYear": false,
    "leapYear": false
  }

isLeapYear(Date): Boolean

Returns true if the input Date is a leap year, 'false' if not.

Parameters

Name Description

date

The date (Date type) to evaluate.

Example

This example indicates whether the input is a leap year.

Source

%dw 2.0
output application/json
---
{
  "leapYear" : isLeapYear(|2016-10-01|),
  "leapYear": isLeapYear(|2017-10-01|)
}

Output

  {
    "leapYear": true,
    "leapYear": false
  }

isLeapYear(LocalDateTime): Boolean

Returns true if the input local date-time is a leap year, 'false' if not.

Parameters

Name Description

datetime

A local date-time (LocalDateTime type) to evaluate.

Example

This example indicates whether the input is a leap year.

Source

%dw 2.0
output application/json
---
{
  "leapYear" : isLeapYear(|2016-10-01T23:57:59|),
  "leapYear": isLeapYear(|2017-10-01T23:57:59|)
}

Output

  {
    "leapYear": true,
    "leapYear": false
  }

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.