Skip to content

RTC Setup (esp32_set_rtc)

What it does: Sets the date and time in the ESP32's internal RTC clock.

esp32_set_rtc

Inputs

  • year, month, day, hour, minute, second: individual date and time components.

Output

  • none (command block).

When to use it

  • When you don't have internet for NTP, but you need valid time.
  • Manual time setting during calibration or service mode.

Tips and pitfalls

  • Enter a valid date/time, otherwise the results of subsequent blocks will be meaningless.
  • If you start NTP synchronization later, RTC will be overwritten to network time.

Generated Python example

from machine import RTC
RTC().datetime((2026, 2, 12, 0, 10, 30, 0, 0))