Timestamp Message
medium
Turns the controller's date and time into an operator message with AM or PM.
What it teaches
GSV(WallClockTime,,LocalDateTime,…) fills seven DINTs: year, month, day, hour, minute, second and microsecond. A message needs each part as text with two digits, '08:06' and not '8:6', which looks right only until the first minute under 10. Pad each field to two digits, as the serial number was padded to four in Serial Number Text. On a 12-hour clock, hour 0 is 12 AM, hour 12 is 12 PM and hour 13 is 01 PM. CONCAT joins two texts at a time, so the message is built one part after another.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| Ref_Clock | InOut | DINT[7] | — | Year, month, day, hour, minute, second, microsecond |
| Ref_Message | InOut | STRING | — | The message for the operator screen |
Required behavior
- Every scan, Ref_Message is 'Last check passed at hh:mm AM on MM/DD/YYYY' for the time in Ref_Clock, such as 'Last check passed at 08:06 AM on 05/09/2024'.
- Ref_Clock holds the year, month, day, hour (0 to 23), minute, second and microsecond, in that order. On a controller, GSV(WallClockTime,,LocalDateTime,Ref_Clock[0]) fills it from the clock.
- The hour shows as 1 to 12 with AM or PM. Hours 0 to 11 are AM and 12 to 23 are PM, so hour 0 is 12 AM, hour 12 is 12 PM and hour 13 is 01 PM.
- Hour, minute, month and day always have two digits. Seconds and microseconds are not shown.
- Never change Ref_Clock.