TestIT:Programming DateTime
Contents
5.3.6 DateTime
Now
Description:
It will return the current date and time (yyyy/MM/dd HH:mm:SS,fff).
Code example:
DateTime.Now(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Symbol to receive result |
Date
Description:
It will get the current date.
Code example:
DateTime.Date(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | String symbol | Symbol to receive result |
DayOfWeek
Description:
It will get the number of the current day of the week (1-7).
Code example:
DateTime.DayOfWeek(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
WeekNumber
Description:
It will return the current week of the year (1-52).
Code example:
DateTime.WeekNumber(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
Month
Description:
It will return the current month of the year (1-12).
Code example:
DateTime.Month(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
Year
Description:
It will return the current year.
Code example:
DateTime.Year(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
DateDiff
Description:
It will get the difference between two dates in either days, hours, minutes, seconds, or milliseconds.
Code example:
DateTime.DateDiff (_ST01,_Start,_End,S)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
| From | String symbol | Symbol value to set as start |
| To | String symbol | Symbol value to set as end |
| Interval | String | Select Interval eg. D = Day, H = Hour, M = minute, S = seconds, MS = milliseconds |
Hour
Description:
It will return the current hour of the day (0-23).
Code example:
DateTime.Hour(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
Minute
Description:
It will return the current minute of the hour (0-59).
Code example:
DateTime.Minute(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |
Second
Description:
It will return current second of a minute (0-59).
Code example:
DateTime.Second(_ST01)
| Parameters | ||
|---|---|---|
| Parameter | Type | Description |
| Result | Int symbol, double symbol or String symbol | Symbol to receive result |