Date/Time To Ticks
ActionStep Reference » Programming » Time » Date/Time To Ticks
The ActionStep Date/Time To Ticks converts the specified date and time value based on a format to the number of ticks and stores the Ticks, Day, Month, Year, Hour, Minute, Second, Millisecond, Day of the Week, and Day of the Year of the result list. The ticks represent the time that is based on the time zone as specified by the Coordinated Universal Time (UTC).
- Open the Programming node in the Workspace Explorer.
- In the Time node, select the Date/Time to Ticks ActionStep.
Parameters:
The ActionStep has the following input parameters:
name |
Description
|
---|---|
Date/Time
|
Specifies the date and/or time.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Format
|
Specifies the format of the date and/or time.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
The date format changes depending on the selected country language. |
The ActionStep gets the system ticks if the format for either date or time is not specified. |
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
|
---|---|
Ticks | Contains the system ticks of the 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 day of the week.
|
Day of the Year |
Contains the current day of the year.
|
Allowed Context Scopes [Fixed, Local, Global]
All values of the result list are determined by the specified format. |
If the date format is not specified, the values of the Day, Month, and Year are based on the system's date. If time format is not specified, values for the Hour, Minute, Second, and Millisecond will be equal to zero (0). An exception occurs when the string value for the Date/Time is empty or does not match the given date and/or time format or not supported in the Gregorian calendar system. |
Example 1 (Shows the converted tick value from a date and time):
This example converts the date and time to its equivalent ticks value for the local DateValue variable with Text as data type. The result of the Ticks is then output via Write Text.
See other Time operations:
Wait Milliseconds
Stopwatch Start
Stopwatch Stop
Date/Time Show
Date/Time Subtract
Date/Time Offset
Date/Time From Ticks