Datetime Compare

This function block compares a given datetime against a reference datetime. The reference can be built from individual date/time parts or defaults to the current system date/time when parts are left empty. The result is a simple boolean check that you can use to control other parts of your scenario.

πŸ“₯ Inputs

  • Input Date (input)

    • Provide a full datetime string in the format YYYY-MM-DD HH:MM:SS to be compared.

  • Year (input)

    • Optional. Provide a year (YYYY). Leave empty to use the current year.

  • Month (input)

    • Optional. Provide a month (MM). Leave empty to use the current month.

  • Date (input)

    • Optional. Provide a day of month (DD). Leave empty to use the current day.

  • Hour (input)

    • Optional. Provide hour (HH). Leave empty to use current hour.

  • Minute (input)

    • Optional. Provide minute (MM). Leave empty to use current minute.

  • Second (input)

    • Optional. Provide second (SS). Leave empty to use current second.

πŸ“€ Outputs

  • Boolean (output)

    • Returns TRUE or FALSE based on the selected relation between the provided Input Date and the assembled reference datetime.

πŸ•ΉοΈ Controls

  • Relation - Dropdown with comparison options: ==, ~=, <, <=, >=, >

    • Choose how the two datetimes will be compared (equal, not equal, less, less or equal, greater or equal, greater).

🎯 Features

  • Easy comparison between a full datetime and a constructed reference datetime.

  • Reference datetime parts default to the current system date/time when left empty.

  • Simple boolean output suitable for logic flows, triggering actions, or logging.

βš™οΈ Running mechanism

  • The block accepts a full datetime as Input Date and builds a reference datetime from the individual part inputs (Year, Month, Date, Hour, Minute, Second).

  • Any part left empty uses the current system value for that part.

  • The block compares the two datetimes using the selected Relation control and emits a boolean result.

πŸ“ Usage instructions

  1. Provide a full datetime string to Input Date in the format YYYY-MM-DD HH:MM:SS.

  2. Optionally fill any of Year, Month, Date, Hour, Minute, Second to form a custom reference. Leave fields empty to use the current system values for those parts.

  3. Select the comparison operator in the Relation dropdown.

  4. Use the boolean output to drive logic, triggers, or logging blocks.

πŸ’‘ Tips and Tricks

  • Combine with Date-Time to easily obtain the current datetime string and feed it into Input Date for quick checks.

  • Use Date-Time List when you want to supply each datetime part from a prebuilt list rather than individual inputs.

  • Use String Input to let an operator type a custom datetime at runtime.

  • Connect the boolean output to Logic Input or other logic blocks (for example And, Or) to build time-based control flows.

  • Log matches or events by connecting the result to CSV Export or Image Logger for audit trails.

  • Use Debug Input to inspect intermediate values while building your scenario.

πŸ› οΈ Troubleshooting

  • If comparisons behave unexpectedly, ensure Input Date matches the required format YYYY-MM-DD HH:MM:SS.

  • If a part input is empty, the block uses the current system value for that partβ€”verify that this is intended.

  • If you need only a date-level comparison (ignore time), set time parts to zeros or ensure both sides use consistent precision.

Last updated

Was this helpful?