How to use RTC in Arduino IDE ?
How do you get time from the RTC in the M5stack ? The documentation is only for micropython. Also is the RTC battery backed up ? Thanks.
Try using this code from this link to add to your M5stack Digital Clock example.
you need to install the RTClib master library to make it work.