DTSetDateTime
Function Block - Sets the local date and time.
This function block is specific for PCMM2G only.
Inputs
-
- If the UTC time needs to be set, change the time zone to UTC using DTSetTimeZone, set the time, then restore the time zone.
Input |
Data Type |
Range |
Unit |
Default |
Description |
---|---|---|---|---|---|
Execute |
BOOL |
FALSE, TRUE |
N/A |
No default |
If TRUE, request to set the local date and time. |
Year |
DINT |
1900 to 2200 |
Year |
No default |
The local date’s new value of the year. |
Month |
DINT |
1 to 12 |
Month |
No default |
The local date’s new value of the month. |
Day |
DINT |
1 to 31 |
Day |
No default |
The local date’s new value of the day. |
Hour |
DINT |
0 to 23 |
Hour |
No default |
The local date’s new value of the hour. |
Min |
DINT |
0 to 59 |
Minute |
No default |
The local date’s new value of the minute. |
Sec |
DINT |
0 to 60 |
Second |
No default |
The local date’s new value of the second.
|
Outputs
Output |
Data Type |
Range |
Unit |
Description |
---|---|---|---|---|
Done |
BOOL |
FALSE, TRUE |
N/A |
If TRUE, the command completed successfully. |
Error |
BOOL |
FALSE, TRUE |
N/A |
If TRUE, an error has occurred. |
ErrorID |
DINT |
No range |
N/A |
Indicates the error if the Error output is set to TRUE. Error Codes
|
Remarks
None
FBD Language Example
FFLD Language Example
IL Language Example
Not available.
ST Language Example
// write the date and time
Inst_DTSetDateTime( bSetDateTime, Year, Month, Day, Hour, Minute, Second );
if Inst_DTSetDateTime.Done then
bSetDateTime := false;
bError := Inst_DTSetDateTime.Error;
ErrorID := Inst_DTSetDateTime.ErrorID;
end_if;
See Also