Real Time Clock, show us the code and we can advice. Or search the forum because most RTC has code examples or parts of examples that you can reuse in an easy way.

Many RTC has mixed registers so you have to do some woodoo activities to sort out the information you want from it