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      Pulse signal at the given date/time
DTEvery   Pulse signal with long period

Important notes

  • 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

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
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)