Date/Time Subtract
ActionStep Reference » Programming » Time » Date/Time Subtract
The ActionStep Date/Time Subtract calculates the difference between the start time and end time.
- Open the Programming node in the Workspace Explorer.
- In the Time node, select the Date/Time Subtract ActionStep.
Parameters:
The ActionStep has the following input parameters:
name |
Description
|
---|---|
Format
|
Specifies the format of the Date and Time
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Date/Time Start
|
The beginning of the time interval.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Date/Time End
|
The end of the time interval.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Here are some characters that can be used to specify the Date and Time format:
- dd - represents the day of the month (01 to 31); a single character removes the leading zero
- ddd - represents the abbreviated name of the day of the week
- dddd - represents the full name of the day of the week
- MM - represents a month (01 to 12); a single character removes the leading zero
- MMM - represents the abbreviated name of the month (Jan. to Dec.)
- MMMM - represents the full name of the month (January to December)
- yy - represents a year (last two digits)
- yyyy - represents a year (in four digits)
- HH - 24-hour format of an hour (00 to 23)
- hh - 12-hour format of an hour with leading zeros (01 to 12); a single character removes the leading zero
- mm - minutes with leading zeros (00 to 59); a single character removes the leading zero
- ss - seconds with leading zeros (00 to 59); a single character removes the leading zero
- fffffff - ten-millionths of a second in a date and time value
- tt - displays either Ante Meridiem or Post Meridiem (AM or PM)
- K - shows the time zone information
Results:
The ActionStep returns the following results:
name
|
description
|
---|---|
Days |
The number of days.
|
Hours
|
The number of hours.
|
Minutes
|
The number of minutes.
|
Seconds |
The number of seconds .
|
Milliseconds | The number of milliseconds. |
Ticks |
The number of ticks.
|
Total Days |
The total number of days.
|
Total Hours
|
The total number of hours.
|
Total Minutes |
The total number of minutes.
|
Total Seconds |
The total number of seconds.
|
Total Milliseconds |
The total number of milliseconds.
|
Allowed Context Scopes [Fixed, Local, Global]
All values of the result list are determined by the specified format |
Example 1 (Calculate days left before due date):
This example creates a local variable named Due Date with Text as data type. The current date is then retrieved and subtracted with the value of the Due Date variable to determine the number of days remaining before the specified due date. The result of the number of days is then output via Message Box.
See other Time operations:
Wait Milliseconds
Stopwatch Start
Stopwatch Stop
Date/Time Show
Date/Time Offset
Date/Time to Ticks
Date/Time From Ticks