GetDateAndTime:
VAR
dtu _getdt : DTU.GetDateAndTime;
dtDate : DATE_AND_TIME;
eTZ : RTCLK.PERIODE;
END_VAR
dtu _getdt.xExecute := TRUE;
dtu _getdt();
IF dtu _getdt.xError THEN
; // error handling
END_IF
IF dtu _getdt.xDone THEN
// done without error
dtDate := dtu _getdt.dtDateAndTime;
eTZ := dtu _getdt.eTimezone;
END_IF
SetDateAndTime:
VAR
dtu _setdt : DTU.SetDateAndTime;
END_VAR
dtu _setdt.dtDateAndTime := DATE_AND_TIME#2008-05-19-20:00:00;
dtu _setdt.xExecute := TRUE;
dtu _setdt();
IF dtu _setdt.xError THEN
; // error handling
END_IF
IF dtu _setdt.xDone THEN
; // done without error
END_IF
GetTimeZoneInformation:
VAR
dtu _gettzi : DTU.GetTimeZoneInformation;
tziInfo : RTCLK.TIME_ZONE_INFO;
END_VAR
dtu _gettzi.xExecute := TRUE;
dtu _gettzi();
IF dtu _gettzi.xError THEN
; // error handling
END_IF
IF dtu _gettzi.xDone THEN
// done without error
tziInfo := dtu _gettzi.tziInfo;
END_IF
SetTimeZoneInformation
VAR
dtu _settzi : DTU.SetTimeZoneInformation;
END_VAR
dtu _settzi.tziInfo := DTU.gc_tziTimeZoneCET;
dtu _settzi.xExecute := TRUE;
DTU.settzi();
IF DTU.settzi.xError THEN
; // error handling
END_IF
IF DTU.settzi.xDone THEN
; // done without error
END_IF
DateConcat:
VAR
eError : DTU.ERROR;
datDate := DATE;
END_VAR
datDate := DTU.DateConcat
(
uiYear := 2005,
uiMonth := 2,
uiDay := 1,
peError := ADR(eError)
);
DateSplit
VAR
eError : DTU.ERROR;
uiYear : UINT;
uiMonth : UINT;
uiDay : UINT;
END_VAR
eError := DateSplit
(
datDate := DATE#2008-05-15,
puiYear := ADR(uiDateSplitYear),
puiMonth := ADR(uiDateSplitMonth),
puiDay := ADR(uiDateSplitDay)
);
DTConcat:
VAR
eError : DTU.ERROR;
dtDate : DATE_AND_TIME;
END_VAR
dtDate := DTConcat
(
uiYear := 2007,
uiMonth := 6,
uiDay := 4,
uiHour := 15,
uiMinute := 22,
uiSecond := 1,
peError := ADR(eError)
);
DTSplit:
VAR
eError : DTU.ERROR;
uiYear : UINT;
uiMonth : UINT;
uiDay : UINT;
uiHour : UINT;
uiMinute : UINT;
uiSecond : UINT;
END_VAR
eError := DTSplit
(
dtDateAndTime := DATE_AND_TIME#2005-08-15-22:06:00,
puiYear := ADR(uiYear),
puiMonth := ADR(uiMonth),
puiDay := ADR(uiDay),
puiHour := ADR(uiHour),
puiMinute := ADR(uiMinute),
puiSecond := ADR(uiSecond)
);
TODConcat
VAR
eError : DTU.ERROR;
todTime : TIME_OF_DAY;
END_VAR
todTime := TODConcat
(
uiHour := 5,
uiMinute := 4,
uiSecond := 3,
uiMillisecond := 2,
peError := ADR(eError)
);
TODSplit:
VAR
eError : DTU.ERROR;
uiHour : UINT;
uiMinute : UINT;
uiSecond : UINT;
uiMillisecond : UINT;
END_VAR
eError := TODSplit
(
todTime := TIME_OF_DAY#22:05:11.003,
puiHour := ADR(uiTODSplitHour),
puiMinute := ADR(uiTODSplitMinute),
puiSecond := ADR(uiTODSplitSecond),
puiMillisecond := ADR(uiTODSplitMillisecond)
);
GetDayOfWeek
VAR
eError : DTU.ERROR;
eWeekday : RTCLK_WEEKDAY;
END_VAR
eWeekday := GetDayOfWeek
(
dtDate := DATE#2008-5-15,
peError := ADR(eError)
);