Java 26.2
Weather
Clear
Default duration
/weather clear
Clear, rain, thunder
The /weather command takes a state and an optional duration — leave the duration off and the game picks a random span, after which the cycle flips the sky back. Set clear, rain or thunder here with an explicit duration, and pair it with gamerule doWeatherCycle false when a map needs the weather to stay put.
Give /weather an explicit duration, and set gamerule doWeatherCycle false so the cycle never overrides it. Without a duration the game picks a random span and then flips the sky on its own.
clear, rain and thunder. thunder also drives lightning and hostile spawns tied to storms; rain is precipitation without lightning.
Seconds on modern Java (for example /weather rain 300 is five minutes). The generator writes the value in the unit your selected version expects.
Java 26.2
Default duration
/weather clear