I have a similar system in my WIP. Essentially I have one passage that gets called and controls whenever time passes in the story. It increments $time through four periods in the day, 0-3. If $time is gt 3, it then increments $day and resets $time to 0.
I only have one “week” in the game so the day doesn’t loop, but you could similarly loop days 0-6 to increment a $week variable, and then a $month. You just have to keep everything in order.
<<set $time++>>
<<if $time gt 3>><<set $time = 0>><<set $day++>><<endif>>
<<if $day gt 6>><<set $day = 0>><<set $week++>><<endif>>
[...]
This “clock” passage (I actually call it ‘tick’) then continues to another passage (called ‘tock’) which sets variables strings I call $timename and $dayname, brute forcing through code like
<<if $time =0>><<set $timename = 'Morning'>>
<<elseif $time =1>><<set $timename = 'Afternoon'>>
[...]
<<if $day = 1>><<set $dayname = 'Monday'>>
[...]
<<endif>>
It also then continues to a transitional display passage explaining to the player that time is passing based on what the variables have changed to: “The sun climbs from the horizon.” type of atmosphere text.
When I’m checking time I want the number so I can check things like <<if $time lt 2>> but I can use the set strings
"It is currently <<print $dayname>> <<print $timename>>."
to produce text like “It is currently Wednesday Morning.”
You want to set it up so your clock/calendar passage is the one thing you need to call to handle time passing from wherever you call it in the story, like
"Oh, you'd like me to make you a sword? Get comfy! This will take a while!" says the old blacksmith...
<<display 'tick'>>
...after many hours of furious clanging and forging, your new sword is ready.
So essentially the “tick” passage automatically advances the hour, advances the day if applicable (it could also advance week, etc…increment hunger and tiredness), sets all the new strings for the current time, then does a fade-out/fade-in “It is Wednesday Evening!” type transition and then continues the story.
(Note: I’m using AXMA Story Maker which uses a very old-school Twine-type code, your exact code will vary.)