Subtract Time
Function: Subtract Time
This function allows you to adjust a specific date and time by subtracting a certain amount of time from it. You can choose the amount (e.g., 5) and the unit (e.g., minutes, hours, days) to precisely calculate a new, earlier date. This is useful for setting deadlines, calculating past events, or scheduling.
Input
- Date: The starting date and time from which you want to subtract. This is a required input.
- Amount: The quantity of time you wish to subtract. For example, if you want to subtract 5 hours, you would enter '5'. This is a required number and must be 0 or greater. If not specified, it defaults to
1. - Unit: The unit of time for the amount you are subtracting. You must select one of the following options:
- Nano seconds
- Milli seconds
- Seconds
- Minutes
- Hours
- Days
- Weeks
- Months
- Years
This is a required selection. If not specified, it defaults to
Minutes.
Output
- Result: The adjusted date and time after subtracting the specified amount of time. This new date will be stored in a variable that you name. If you don't provide a name, it will be stored in a variable called
RESULT.
Execution Flow
Real-Life Examples
Example 1: Setting a Project Deadline
Imagine you have a project due today at 5 PM, but you want to set an internal deadline 3 days earlier.
- Inputs:
- Date:
2023-10-27 05:00 PM - Amount:
3 - Unit:
Days - Result variable name:
InternalDeadline
- Date:
- Result: The
InternalDeadlinevariable will hold the value2023-10-24 05:00 PM.
Example 2: Calculating a Meeting Start Time
You've scheduled a 30-minute meeting, and you know the end time is 11:00 AM. You want to find out when it should start.
- Inputs:
- Date:
2023-11-15 11:00 AM - Amount:
30 - Unit:
Minutes - Result variable name:
MeetingStartTime
- Date:
- Result: The
MeetingStartTimevariable will hold the value2023-11-15 10:30 AM.
Example 3: Adjusting a System Log Entry
A system log entry has a timestamp, and you realize it's off by 2 hours due to a time zone issue. You need to correct it.
- Inputs:
- Date:
2024-01-01 03:00 PM - Amount:
2 - Unit:
Hours - Result variable name:
CorrectedLogTime
- Date:
- Result: The
CorrectedLogTimevariable will hold the value2024-01-01 01:00 PM.