You mean ingame time or real world time?
In game time is pretty easy, you just gotta set up a counter time system.
For example:
time_second += 1; (this can go quite fast, as that is one second per frame, getting real seconds depends on the framerate of the game you set up)
if time_second = 60 {time_minutes += 1}
if time_minutes = 60 (time_hours += 1}
if time_hours = 24 (time_days += 1}
and so on. This is pretty basic, but with a little bit of creativity you can make it quite complex.
Tip: do not forget to implement a pause function from the beginning of the game. If you start doing all kinds of stuff that depends on such time variables, and having no pause option,
it's gonna be a pain in the *** to re-check all the code you've already written to make it all pause when needed.