System Time As MODBUS Register values

I need to send time synch values from SCADA to a modbus device. The device is looking for SECOND, MINUTE, HOUR, DAY, MONTH, YEAR to be sent from SCADA on six (6) seperate registers (one register for each element). I believe the Gateway server system time/date value will suffice. What is the best way toparse the server system time/date into the individual elements required?

You could probably pull each piece out with the system.date.get* functions.

This will probably be the way. Thanks Kevin.

Update:
I discovered that there are Expression Functions for get* which work really well for my purposes.

However, getMonth(now()) returns a value of "1" and not "2" as you would expect for February. Does this function reference from month "0" for January?

EDIT:

You answered this on before for someone else.

Found it in the manual:
https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/date-and-time/get

"Extracts the month from a date, where January is month 0."

Extracts the month from a date, where January is month 0.

yeah, I was editing my post when you responded. I found where you previously answered this and I should have just read more closely.

It's okay, just a chance for me to add more links to the new manual :slight_smile:

2 Likes