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
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 PulseClosedWhen the step gets activated, the action is activated for a single execution, and possibly once again when the step is deactivated signal at the given date/time
DTEvery Pulse signal with long period

  • The real-time clock may not be available on all controller hardware models. Please consult the controller hardware specifications for real-time clock availability.

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

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

DTYEAR: extract the year from a date stamp

Q := DTYear (iDate);

IDATE : DINT numerical stamp representing a date. This is output of DTCURDATE.
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. This is output of DTCURDATE.
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. This is output of DTCURDATE.
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. This is output of DTCURDATE.
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. This is output of DTCURDATE.
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. This is output of DTCURDATE.
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. This is output of DTCURDATE.
Q : DINT     Milliseconds of the time (0..999)