To toggle off weather type in /gamerule doWeatherCycle false
If you simply want to enable a particular weather cycle for a near infinite amount of time, you can use the command /weather type time
, for example if you want to have clear weather for a year, you could use /weather clear 9999999999
.
Minecraft Java Edition allows suffixing with a unit, d
and s
to indicate in-game days
and seconds
respectively. The maximum allowed value for this duration is (2-2^-33)*2^127
or 340282346638528859811704183484516925440
so you could make the weather essentially permanent with:
/weather clear 340282346638528859811704183484516925440d
but a lower number is probably fine.
In Bedrock Edition, the number has a maximum value of 1000000
and you cannot use any unit suffixes.