Ask AI
Skip to main content

Subtract Time

Function: Subtract Time

This action allows you to adjust a specific date and time by subtracting a certain amount of time from it. For example, you can use it to find out what the date and time was 3 hours ago, 5 days ago, or 2 months ago from a given point in time. It's useful for scheduling, calculating deadlines, or tracking historical events.

Input

  • Date: The starting date and time from which you want to subtract time. This is a required input.
  • Amount: The quantity of time you wish to subtract. This must be a positive number and is required.
  • Unit: The unit of time for the amount you are subtracting. This is a required input and must be one of the following:
    • NANOS (nanoseconds)
    • MILLIS (milliseconds)
    • SECONDS
    • MINUTES
    • HOURS
    • DAYS
    • WEEKS
    • MONTHS
    • YEARS

Output

  • Result: The new date and time after the specified amount of time has been subtracted. This output will be stored in a variable you name.

Execution Flow

Real-Life Examples

Example 1: Calculating a deadline for a task

Imagine you have a task due at a specific date and time, and you want to know when it was exactly 24 hours before the deadline.

  • Inputs:
    • Date: 2023-10-27 17:00:00 (representing the deadline)
    • Amount: 24
    • Unit: HOURS
    • Result (variable name): task_start_time
  • Result: The task_start_time variable will hold the value 2023-10-26 17:00:00.

Example 2: Finding a customer's signup anniversary

A customer signed up on a particular date, and you want to find out the date exactly 1 year before their signup to send them a "one year until your anniversary" reminder.

  • Inputs:
    • Date: 2024-05-15 10:30:00 (customer's signup date)
    • Amount: 1
    • Unit: YEARS
    • Result (variable name): anniversary_reminder_date
  • Result: The anniversary_reminder_date variable will hold the value 2023-05-15 10:30:00.

Example 3: Adjusting a timestamp for log analysis

You have a log entry timestamp and you need to see what happened 30 minutes prior to that event.

  • Inputs:
    • Date: 2023-11-01 09:45:22 (log entry timestamp)
    • Amount: 30
    • Unit: MINUTES
    • Result (variable name): previous_log_time
  • Result: The previous_log_time variable will hold the value 2023-11-01 09:15:22.