Skip to content

RTC Time Folders (cas_var)

What it does: Returns the selected component from the RTC time (year, month, day, hour, ...).

cas_var

Inputs

  • no data inputs.
  • Field idx: date/time folder selection.

Output

  • numerical value of the selected RTC folder.

When to use it

  • Decision based on current hour, day or date.
  • Creation of time stamps and conditions in the program.

Tips and pitfalls

  • For correct values, the RTC must be set (manually or via NTP).
  • Check the time zone if you combine local time and NTP.

Generated Python example

from machine import RTC
hour = RTC().datetime()[4]