Changes or queries the world's game time.
Syntax[]
- Java Edition
time add <time>- Adds
<time>to the in-game daytime.
- Adds
time query (daytime|gametime|day)- Queries current time.
time set (day|night|noon|midnight)time set <time>- Sets the internal daytime.
- Bedrock Edition
time add <amount: int>- Adds
<time>to the internal daytime.
- Adds
time query <daytime|gametime|day>- Queries current time.
time set <amount: int>time set <time: TimeSpec>- Sets the internal daytime.
Arguments[]
JE: <time>: time
BE: amount: int: int
- Specifies the time to add or set.
- In Java Edition, it must be a single-precision floating point number suffixed with a unit. Units include:
d: an in-game day, 24000 gameticks;s: a second, 20 gameticks;t(default and omitable): a single gametick; the default unit.
.5dis same as 12000 ticks.
In Bedrock Edition it must be a 32-bit integer number.
daytime|gametime|day
- Specifies the time to query. Must be
daytime,gametimeorday.daytime- the number of game ticks since dawn. (the internal daytime modulo 24000)gametime- the age of the world in game ticks. (the game time modulo 2147483647)day- the number of in-game days passed. (the internal daytime divided by 24000, then modulo 2147483647)
JE: day|night|noon|midnight
BE: time: TimeSpec: enum
- Specifies the time to set.
- Must be
day,night,noon,midnight,sunrise[Bedrock Edition only], orsunset[Bedrock Edition only].day= 1,000night= 13,000noon= 6,000midnight= 18,000sunrise= 23,000sunset= 12,000
Notes[]
/time set ... command in Java Edition always directly sets the "internal daytime" to the specified number. But in Bedrock Edition, when time: TimeSpec is specified, it increases the "internal daytime" to meet the specified time: TimeSpec.
For example:
- in Java Edition, when executing
/time set dayor/time set 1000, the "internal daytime" is set to 1000, so the "day" value returns to 0. - In Bedrock Edition, when executing
/time set 1000, the "internal daytime" is also set to 1000. But if now the "internal daytime" is 25001 (1 day + 1001 ticks), after executing/time set day, it won't become 1000 or 25000, since it only increases time when usingtime: TimeSpec. In fact, it turns into 49000 (2 days + 1000 ticks), and the "day" value becomes 2. If now the "internal daytime" is 25000 (1 day + 1000 ticks), after executing/time set day, it remains unchanged.
Result[]
| Command | Trigger | Java Edition | Bedrock Edition |
|---|---|---|---|
| any | the arguments are not specified correctly | Unparseable | Unparseable |
| Otherwise | Successful | ||
Output[]
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
/time add ... | Java Edition | On success | 1 | 1 | the time in this day (the in-game daytime modulo 24000) after execution |
/time query ... | On success | 1 | 1 | the obtained value | |
| any | Bedrock Edition | On fail | 0 | N/A | N/A |
| On success | 1 | N/A | N/A |
Examples[]
- To set the time to 1,000:
time set 1000 - To add one day to the world time:
time add 24000 - To change/reset in-game day count to desired number:
time set <desired day number*24000+time of day in ticks>; to change day count to day 472 at noon (6000):time set 11334000
History[]
| Java Edition Beta | |||||
|---|---|---|---|---|---|
| 1.3 | Added /time. Both add and set can be used. | ||||
| Java Edition | |||||
| 1.3.1 | 12w16a | /time is now usable in singleplayer.
| |||
/time set (<TimeSpec>|<time>) now accepts day (equivalent to 0) and night (equivalent to 12500). | |||||
| 1.7 | 13w36a | /time set day now is equivalent to 1000, and /time set night now is equivalent to 13000. | |||
| 1.8 | 14w29a | Added /time query (daytime|gametime|day), accepting daytime and gametime. | |||
| 1.9 | 15w49b | /time query (daytime|gametime|day) now accepts day as a value. | |||
| 1.13 | 18w01a | Added the options noon and midnight to /time set (<TimeSpec>|<time>). | |||
| Pocket Edition Alpha | |||||
| v0.16.0 | build 1 | Added /time. | |||
| Bedrock Edition | |||||
| 1.17.30 | beta 1.17.30.20 | Now /time set <amount: int> directly sets the "internal day" to the specified number, instead of incrementing the "internal day" to satisfy the specified daytime. | |||