How do I make it day or night on my Minecraft server?
In this article
Time on a Minecraft server runs on its own: a full day lasts 20 real minutes, of which about 7 are night. As an operator you can set the time, skip the night, freeze the clock or let players sleep through the night more easily. Everything below is done with commands from the console or in-game.
Setting the time
- Go to the game panel and click your server.
- Open the Console tab.
- Type
time set dayand press Enter for morning, ortime set nightfor night.
In-game the same works as /time set day for operators. Other useful values: time set noon (midday), time set midnight, or a number of ticks: time set 0 is sunrise, 6000 noon, 12000 sunset and 18000 midnight. With time add 6000 you jump ahead a quarter day; time query daytime shows the current tick.
Freezing the time
Want it to stay day permanently, for example on a creative or building server? Set the time and then turn the day-night cycle off:
time set day followed by gamerule doDaylightCycle false
The sun now stops at the position you set. Use gamerule doDaylightCycle true to let the clock run again. This is a gamerule, so it is saved in the world and stays after a restart. Stopping the weather as well? See stopping the rain.
Sleeping on a server
In vanilla, everyone online has to be in bed before the night is skipped. On a server with more than two players that hardly ever happens. Since 1.21 the fix is built in:
gamerule playersSleepingPercentage 1
Now one sleeping player is enough (1 percent, rounded up to at least one player). Set it to 50 for half the players, or 101 to make sleeping impossible. On older versions or for a friendly chat message ("Steve is sleeping, 1/5") you use a plugin such as Harbor or the sleep feature of EssentialsX.
Time per world
Time is stored per world. On a server with several worlds through Multiverse, set the time while you are in that world, or use /mv modify set time day for a world that should always be day. Without Multiverse the console command applies to the main world.
Automatically day at every login?
A player who joins a server at night cannot do anything about the time unless they are OP. If you want that anyway, a plugin with a timer (for example a scheduled time set day every real hour) or a simple command block with a clock circuit does the job. On most servers, playersSleepingPercentage is the more elegant solution: players regulate the night themselves.
Related
- Tick speed: does not change how long a day lasts, only how fast plants grow.
doInsomnia false: prevents phantoms for players who have not slept in a long time.
Stuck? Open a ticket and mention the exact command and what the console replied.
Launch your server in 60 seconds on our own hardware.