Try using this code from this link to add to your M5stack Digital Clock example.
https://github.com/adafruit/RTClib/blob/master/examples/ds3231/ds3231.ino
you need to install the RTClib master library to make it work.
Try using this code from this link to add to your M5stack Digital Clock example.
https://github.com/adafruit/RTClib/blob/master/examples/ds3231/ds3231.ino
you need to install the RTClib master library to make it work.