Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Time of day in RTMCPro V4


ScottB Jan 24, 2012 06:03 AM

Hi,

I need to find the time of day so that in an IIF statement I can display some text based on the time of day and the light level.

Does anyone have some RTMC code that gives the time in a format that I can use for this? Basically I have a light sensor and if I know the time of day I can put up the cloud status, e.g. if it is mid-day and the light is below 1000 uE/M/S then it is cloudy...

Thanks!

Scott.


Dana Jan 24, 2012 07:45 PM

Have you looked at the Time Functions in RTMC? SystemTime will return the current computer time. Timestamp will return the timestamp for an associated record.

Dana


jtrauntvein Jan 25, 2012 01:13 AM

In order to evaluate the time of day, you will want to do something like the following (assuming a variable name of "value"):

IIF(FormatTime(Timestamp(value), $"%H%M") >= 700 OR FormatTime(Timestamp(value), $"%H%M") <= 1800), daylight_expr, night_expr)

The FormatTime function will produce a string that has only the hour and minute components.

Log in or register to post/reply in the forum.