Display or say the current daytime ticks
You can store it in a scoreboard using /execute store
.
Preparation:
/scoreboard objectives add scoreboard_name dummy
Storing the time in a scoreboard:
execute store result score $gametime scoreboard_name run time query daytime
And then you can display it like any other score with /tellraw
:
tellraw @p {"score":{"name":"$gametime","objective":"scoreboard_name"}}
scoreboard_name
is an arbitrary chosen scoreboard name, $gametime
an arbitrarily chosen fake player name that cannot possibly be the same as a real player name. Start it with #
if you want to hide it from scoreboard sidebar displays.