Date & Time States in Circuit | Format, Calculate, and Process Date-Time Data | Qntrl Circuit Online Help

Date & Time

Date & Time states enable date and time-based operations such as formatting, arithmetic calculations, difference computation, retrieving the current datetime, and extracting specific components.

Date & Time Format Reference  

Date & Time states follow Java 8 DateTime formats.

Pattern

Description

Example

yyyy

Four-digit year

2025

MM

Month as a two-digit number

03

MMM

Month as abbreviated name

Mar

MMMM

Month as full name

March

dd

Day of the month

15

HH

Hour in 24 hour format (00–23)

14

hh

Hour in 12 hour format (01–12)

02

mm

Minute

45

ss

Second

30

SSSSSSSSS

Nanoseconds

000000000

'T'

ISO-8601 literal separator between date and time

2025-03-15T14:45:30

 

Nanoseconds are returned only if present in the input; otherwise, the value defaults to zero.

 

Duration Format Pattern  

Duration values follow the ISO-8601 pattern:

P(n)DT(n)H(n)M(n)S

Components  
  • P – Indicates the start of the duration period

  • D – Number of days

  • T – Separates date and time components

  • H – Number of hours

  • M – Number of minutes

  • S – Number of seconds

Example:

P2DT3H15M10S - Represents 2 days, 3 hours, 15 minutes, and 10 seconds.

Below are the states available in the Date & Time.

Add  

Adds a specified duration to a given date or time value.

Builder View Payload Configuration

  • Date Time: Date or date time value (static or dynamic).

  • Input: Specify the input format, time zone, and locale.

  • Duration: Duration to be added to the input date time.

  • Output: Define the output format, time zone, and locale.

 

Code View  

{

    "Add Duration": {

"module": "datetime",

"task_id": "add",

"payload": {

     "datetime": "2025-08-25",

     "input": {

"format": "yyyy-MM-dd",

"zone": "Asia/Kolkata"

     },

    "output": {

"format": "dd-MMMM-yyyy",

"zone": "UTC",

"locale": "fr-FR"

   },

   "duration": "P2D"

},

   "next": "End"

   }

}

Subtract   

Subtracts a specified duration from a given date or time value.

Builder View Payload Configuration

  • Date Time: Specify the date time value (static or dynamic, for example $.time).

  • Input: Specify the input format, time zone, and locale.

  • Duration: Duration to be reduced from the input date time.

  • Output: Define the output format, time zone, and locale.

 

Code View  

{

    "Add Duration": {

"module": "datetime",

"task_id": "subtract",

"payload": {

     "datetime": "2025-08-25",

     "input": {

"format": "yyyy-MM-dd",

"zone": "Asia/Kolkata"

     },

     "output": {

"format": "dd-MMMM-yyyy",

"zone": "UTC",

"locale": "fr-FR"

     },

     "duration": "P2D"

},

"next": "End"

    }

}

Format

Converts date or time values into a specified string format.

Builder View Payload Configuration

Configure the following payload:

  • Date Time: Specify the date time value (static or dynamic, for example $.time).

  • Input: Specify the input format, time zone, and locale.

  • Output: Define the output format, time zone, and locale.

 

Code View  

{
"Format Date": {
      "module": "datetime",
      "task_id": "format",
      "payload": {
       "datetime": "2025-08-25",
       "input": {
            "format": "yyyy-MM-dd",
            "zone": "Asia/Kolkata"
       },
       "output": {
            "format": "dd-MMMM-yyyy",
            "zone": "UTC",
            "locale": "fr-FR"
       }
      },
      "next": "End"
}
}

 

Difference  

Calculates the time difference between two date or time values.

Builder View Payload Configuration

Configure the following payload:

  • Start Date Time: Provide the start date time values.

  • End Date Time: Provide the end date time values.

  • Input: Specify the input format, time zone, and locale.

  • Units: Specifies the unit in which the result is returned (for example, days, hours, minutes).

 

Code View  

{

    "Date Difference": {

"module": "datetime",

"task_id": "difference",

"payload": {

    "start_datetime": "2025-08-25",

    "end_datetime": "2025-10-25",

    "input": {

"format": "yyyy-MM-dd",

"zone": "Asia/Kolkata"

    },

    "units": ["days", "hours", "minutes"]

},

"next": "End"

    }

}


Current Datetime  

Retrieves the current date and time during circuit execution.

Example Use Case  

This state can be used to timestamp records or logs at runtime.

Builder View Configuration

Configure the following payload:

  1. Output: Specify the input format, time zone, and locale

  2. Include Time: 

    1. Enabled → returns current date and time

    2. Disabled → returns start of the day

 

Code View  

{

    "Current Datetime": {

"module": "datetime",

"task_id": "current_datetime",

"payload": {

    "output": {

"format": "dd-MMMM-yyyy",

"zone": "UTC",

"locale": "fr-FR"

    },

"include_time": true

},

"next": "End"

    }

}

Extract Duration  

Extracts specific units from a duration value.

Builder View Payload Configuration

Configure the following payload:

  • Duration: Enter the duration

  • Units: Specifies the unit in which the result is returned (for example, days, hours, minutes).

If units are not selected, the result is returned as a duration.


Code View  

{

    "Extract Duration": {

"module": "datetime",

"task_id": "extract_duration",

"payload": {

     "duration": "P2DT5H7M",

     "units": ["hours", "minutes", "seconds"]

},

"next": "End"

}

}

Extract Datetime  

Retrieves specific date or time components from a datetime value.  

Builder View Payload Configuration

Configure the following payload:

  • Datetime: In this key only the date time will be passed dynamically (Ex:$.time).

  • Input: Specify the input format, time zone, and locale.

  • Units: Select the unit from dropdown. The retrieved date time is returned as selected units.

 

Code View  

{

    "Extract Datetime": {

"module": "datetime",

"task_id": "extract_datetime",

"payload": {

     "datetime": "2025-10-25",

     "input": {

"format": "yyyy-MM-dd",

"zone": "Asia/Kolkata"

     },

     "units": ["days", "hours", "minutes"]

},

"next": "End"

    }

}



    • Related Articles

    • User Logs

      Early Access This feature is not enabled for all users. If you'd like to try it out, please email our support team for early access. User Logs can be used to individually manage and track the activity of your organization’s users in Qntrl. User logs ...
    • Introduction to States of Circuit

      States are the building blocks of a circuit that can perform tasks, make decisions, or simply pass the output from one state to another. The state defines a specific task or process that has to be executed in that segment of the circuit. Circuit ...
    • Wait

      The Wait state introduces a pause or delay within your circuit, temporarily halting the execution for a specified duration before resuming and progressing to the next state. The delay duration can be configured in seconds. For example, if you set a ...
    • Configure Schedules

      Qntrl allows users to trigger custom functions periodically or at defined time intervals using Schedules. It can be used to obtain automated updates, weekly notifications, or monthly reports in an organization. Business Scenarios Schedule recurring ...
    • Test/Execute a Circuit

      Once you configured your circuit, you have three options: Save: Stores your current configuration without executing or publishing the circuit. Save and Execute: Saves and immediately runs the circuit without publishing. This is typically used for ...

    You are currently viewing the help articles of Qntrl 3.0. If you are still using our older version and require guidance with it, Click here.