Date/Time Offset
ActionStep Reference » Programming » Time » Date/Time Offset
The ActionStep Date/Time Offset gets the date/time value after either adding or subtracting the specified offset to a given date/time.
- Open the Programming node in the Workspace Explorer.
- In the Time node, select the Date/Time Offset ActionStep.
Parameters:
The ActionStep has the following input parameters:
name |
Description
|
---|---|
Format
|
Specify the format of the date and time.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Date/Time
|
The date/time information.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Offset Mode
|
The offset mode.
Accepted Values: Years, Months, Days, Hours, Minutes, Seconds, Milliseconds, Ticks Allowed Context Scopes [Fixed, Local, Global]Allowed Context Types [Variable, Parameter, Enum] |
Offset
|
The positive or negative offset to add/subtract from the given date/time.
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
|
---|---|
Date/Time |
Contains the calculated date and time.
|
Day |
Contains the current day.
|
Month |
Contains the current month.
|
Year |
Contains the current year.
|
Hour |
Contains the current hour.
|
Minute | Contains the current minute. |
Second |
Contains the current second.
|
Millisecond |
Contains the current millisecond.
|
Day of the Week |
Contains the current days of the week.
|
Day of the Year | Contains the current day of the year. |
Ticks |
Contains the system ticks of the date and time.
|
Allowed Context Scopes [Fixed, Local, Global]
All values of the result list are determined by the specified format |
Example 1 (Determine date and time of another location):
This example creates two local variables, PH Time Zone and DE Time Zone with Number as data type. The value of the variables is then subtracted to get the time zone (UTC/GMT) difference in hours. The date/time of the current location is retrieved and used the time zone difference as its offset value. The result of the Date/Time Offset is then output via Message Box.
See other Time operations:
Wait Milliseconds
Stopwatch Start
Stopwatch Stop
Date/Time Show
Date/Time Subtract
Date/Time to Ticks
Date/Time From Ticks