Is leap year action in Datetime

The Is leap year action in the Datetime package verifies whether the year in the specified date is a leap year and stores the result in a Boolean variable.

To check whether a given year is a leap year, do the following:
  1. Double-click or drag the Is leap year action from the Datetime package in the Actions palette.
  2. Select either the Datetime or Variable tab from the Date and time variable to check field:
    • Datetime: Select the date, time, and timezone values from the dropdown.
    • Variable: Select a Datetime variable.
  3. Select the boolean variable from the Assign the output to a variable field to assign the output.
    Note: If you select system date in the Date and time variable to check field and the variable value is a leap year, the system stores True as the output in the Boolean variable. If the value in the Date and time variable to check field is not a leap year, the system stores False as the output in the Boolean variable. For example, the system date (10-07-2024) will retrieve the value as True because 2024 is a leap year. Similarly, the system date (10-07-2025) will retrieve the value as False, as 2025 is not a leap year.

Example of using Is leap year action in an automation

In this example, you will create an automation that checks if the given year is a leap year and stores the output in a variable.

Procedure

  1. Create a bot.
    1. On the left panel, click Automation.
      A list of available bots and forms is displayed.
    2. Click Create a bot.
    3. Enter the bot name: Datetime_Is leap year.
    4. Click Create and Edit.
  2. Create the following user-defined variables using the Create variable (+) icon at the top of the Variables menu.
    Variable name Variable type Value
    invoiceDate Datetime Value 4/12/2023 10:45 AM GMT (UTC+0:00) GMT
    isLeapYear Boolean False
  3. Double-click or drag the Is leap year action from the Datetime package in the Actions palette.
  4. In the Date and time variable to check field, select invoiceDate variable.
  5. In the Assign the output to a variable field, select isLeapYear.
  6. To print the value, double-click or drag the Message box action. In the Enter the message to display field, enter the following values:
    SystemDate: $System:Date.Datetime:isLeapYear.Boolean:toString$
    InvoiceDate: $invoiceDate.Datetime:isLeapYear.Boolean:toString$

    To see the output value, convert the Datetime to Boolean and Boolean to a String variable.

  7. Click Save and then Run.
    The output is displayed as:

    Checks if a given year is a leap year and stores the output in a Boolean variable