The DS3231 is a low-cost, precision I2C real-time clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The Parallax DS3231 AT24C32 Real Time Clock Module includes a battery backup, and maintains accurate timekeeping when power to the module is interrupted.
This device was demonstrated extensively in the JonnyMac Beginner Series for Spin2 and the video is linked under additional resources.
To set the time and date, change the highlighted lines of code in jm_ds3231_demo.spin2 and load to Flash.
pub initialize_rtc() '' Manually set RTC registers to current time and date rtc.set_time($30, $04, $15) ' 3:04:30 pm rtc.set_calendar($07, $23, $01, $21) ' Saturday, 23 JAN 2021