GetDateAndTime (FB)ΒΆ
FUNCTION_BLOCK GetDateAndTime
This function block reads the realtime clock.
It returns the time of the local time zone (i.e. a possible switch to summer/standard time will be regarded).
The current time zone switch can be defined by SetTimeZoneInformation.
If a switch to summer/standard time has become necessary since the last polling of the time, this is done automatically.
At the start of the module the outputs dtDateAndTime and eTimezone are reset. (DT#1970-01-01-00:00 and RTCLK_UNKNOWN).
After successful operation they will contain the current local time.
- InOut:
Scope
Name
Type
Comment
Input
xExecuteBOOLRising edge: Action startFalling edge: Resets outputs. If a falling edge occurs before the function block has completed its Action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values (xDone, xError, iError) are present at the outputs for exactly one cycle.Output
xDoneBOOLAction successfully completed
xBusyBOOLFunction block active
xErrorBOOLTRUE: error occurred, function block aborts actionFALSE: no erroreErrorError description for diagnosis
dtDateAndTimeDTCurrent local time
eTimezoneCurrent time zone