Updated:
1. Check once
/time query minecraft:day repetitions
/time query minecraft:day
Java 26.1 and newer. In 1.21.11 and older, and in Bedrock, use /time query day and /time query daytime. See time command.
2. Day count in the sidebar (repeating)
/scoreboard objectives add day dummy "World days"
/scoreboard objectives setdisplay sidebar day
Run those once, then put this in a repeating command block:
/execute store result score Day day run time query minecraft:day repetitions
Use time query day in 1.21.11 and older. Names starting with # are hidden from the sidebar.
3. Clock setup (once)
/scoreboard objectives add clock dummy
/scoreboard players set #24000 clock 24000
/scoreboard players set #1000 clock 1000
/scoreboard players set #24 clock 24
/scoreboard players set #60 clock 60
/scoreboard players set #6 clock 6
A day is 24000 ticks, time 0 is 6:00 AM and 1000 ticks is one hour.
4. Clock (repeating)
/execute store result score #t clock run time query minecraft:day
/scoreboard players operation #t clock %= #24000 clock
/scoreboard players operation #h clock = #t clock
/scoreboard players operation #h clock /= #1000 clock
/scoreboard players operation #h clock += #6 clock
/scoreboard players operation #h clock %= #24 clock
/scoreboard players operation #m clock = #t clock
/scoreboard players operation #m clock %= #1000 clock
/scoreboard players operation #m clock *= #60 clock
/scoreboard players operation #m clock /= #1000 clock
/title @a actionbar [{"score":{"name":"#h","objective":"clock"}},{"text":":"},{"score":{"name":"#m","objective":"clock"}}]
Use time query daytime on the first line in 1.21.11 and older. Minutes under 10 show as one digit, such as 13:5.
5. New day message (repeating)
/execute unless score Day day = #prev day run title @a title [{"text":"Day "},{"score":{"name":"Day","objective":"day"}}]
/scoreboard players operation #prev day = Day day
Chain these after step 2. The title shows once each time the day changes, including after sleeping.
Troubleshooting
- Syntax error: match the time query form to your version.
- Clock is off by 6 hours: add #6 in step 4.
- Bedrock Edition: there is no execute store, so results cannot go into scores.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.