Real Time Clock management functions
The following functions read the real time clock of the target system:
DTCurDate Get current date stamp.
DTCurTime Get current time stamp.
DTCurDateTime Get current date and time stamp.
DTDay Get day from date stamp.
DTMonth Get month from date stamp.
DTYear Get year from date stamp.
DTSec Get seconds from time stamp.
DTMin Get minutes from time stamp.
DTHour Get hours from time stamp.
DTMs Get milliseconds from time stamp.
The following functions format the current date/time to a string:
DAY_TIME With predefined format.
DTFORMAT With custom format.
The following functions are used for triggering operations:
DTAt Pulse signal at the given date/time.
DTEvery Pulse signal with long period.
|
Real Time clock may be not available on some targets. Please refer to OEM instructions for further details about available features. |
DAY_TIME: get current date or time
Q := DAY_TIME (SEL);
SEL : DINT specifies the wished information (see below).
Q : STRING wished information formatted on a string.
Possible values of SEL input:
Value |
Description |
1 |
current time - format: 'HH:MM:SS'. |
2 |
day of the week. |
0 (default) |
current date - format: 'YYYY/MM/DD'. |
DTCURDATE: get current date stamp
Q := DTCurDate ();
Q : DINT numerical stamp representing the current date.
DTCURTIME: get current time stamp
Q := DTCurTime ();
Q : DINT numerical stamp representing the current time of the day.
DTCURDATETIME: get current time stamp (function block)
Inst_DTCurDateTime (bLocal);
bLocal : BOOL TRUE if local time is requested (GMT if FALSE).
.Year : DINT Output: current year
.Month : DINT Output: current month
.Day : DINT Output: current day
.Hour : DINT Output: current time: hours
.Min : DINT Output: current time: minutes
.Sec : DINT Output: current time: seconds
.MSec : DINT Output: current time: milliseconds
.TmOfDay : TIME Output: current time of day (since midnight)
.DST : BOOL Output: TRUE if Daylight Saving Time is active
DTYEAR: extract the year from a date stamp
Q := DTYear (iDate);
IDATE : DINT numerical stamp representing a date.
Q : DINT year of the date (ex: 2004).
DTMONTH: extract the month from a date stamp
Q := DTMonth (iDate);
IDATE : DINT numerical stamp representing a date.
Q : DINT month of the date (1..12).
DTDAY: extract the day of the month from a date stamp
Q := DTDay (iDate);
IDATE : DINT numerical stamp representing a date.
Q : DINT day of the month of the date (1..31).
DTHOUR: extract the hours from a time stamp
Q := DTHour (iTime);
ITIME : DINT numerical stamp representing a time.
Q : DINT Hours of the time (0..23).
DTMIN: extract the minutes from a time stamp
Q := DTMin (iTime);
ITIME : DINT numerical stamp representing a time.
Q : DINT Minutes of the time (0..59).
DTSEC: extract the seconds from a time stamp
Q := DTSec (iTime);
ITIME : DINT numerical stamp representing a time.
Q : DINT Seconds of the time (0..59).
DTMS: extract the milliseconds from a time stamp
Q := DTMs (iTime);
ITIME : DINT numerical stamp representing a time.
Q : DINT Milliseconds of the time (0..999).
Real Time Clock management functions |
IEC 61131-3 Automation platform > Programming - Reference guide > Advanced operations > Real Time Clock management functions |
Created with the Personal Edition of HelpNDoc: Protect Your Confidential PDFs with These Simple Security Measures