Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/time: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(7 intermediate revisions by the same user not shown)
Line 4: Line 4:
* 2 {{only|java|short=1}}
* 2 {{only|java|short=1}}
* 1 {{only|bedrock|short=1}}
* 1 {{only|bedrock|short=1}}
|others=Cheat only{{only|bedrock|short=1}}
|others=[[Minecraft:Cheat]] only{{only|bedrock|short=1}}
}}
}}


Changes or queries the world's game time or the time of a world clock.
Changes or queries the [[Minecraft:world]]'s game [[Minecraft:time]] or the time of a [[Minecraft:world clock]].


== Usage ==
== Usage ==
There are four types of time involved in this command:
There are four types of time involved in this command:
* '''Gametime''' - The total number of game ticks that have elapsed in the world.
* '''Gametime''' - The total number of [[Minecraft:game tick]]s that have elapsed in the world.{{note|name=32int|Stored as a 64-bit signed integer, but returned modulo <math>2^{31}-1</math>.}}
* '''Daylight cycle time''' (aka. '''internal daytime''') - The total number of game ticks that have elapsed during the daylight cycle. It does not elapse when the game rule {{gmr|advance_time}} is <code>false</code>.
* '''Daylight cycle time''' (aka. '''internal daytime''') - The total number of game ticks that have elapsed during the daylight cycle. It does not elapse when the game rule {{gmr|advance_time}} is <code>false</code>.
* '''Daytime''' - The number of game ticks that have elapsed since sunrise on current day. It is the result of dividing the daylight cycle time modulo 24,000.
* '''Daytime''' - The number of game ticks that have elapsed since sunrise on current day. It is the result of dividing the daylight cycle time modulo 24,000.
* '''Day''' - The number of days that have elapsed during the daylight cycle. It is the result of floor division by 24,000 of the daylight cycle time.
* '''Day''' - The number of days that have elapsed during the daylight cycle. It is the result of floor division by 24,000 of the daylight cycle time.
{{MC/In|java}}, if the world is frozen by the {{MC/Cmd|tick}} command, the four times above do not elapse.
{{IN|java}}, if the world is frozen by the {{cmd|tick}} command, the four times above do not elapse.
* '''World clock time''' - the time the world clock is set to.
* '''World clock time''' - the time the [[Minecraft:world clock]] is set to.


<code>/time set ...</code> command {{MC/In|java}} always directly sets the daylight cycle time to the specified number. But {{MC/In|bedrock}}, when {{MC/Cd|time: TimeSpec}} is specified, it '''increases''' the daylight cycle time to meet the specified {{MC/Cd|time: TimeSpec}}.
<code>/time set ...</code> command {{in|java}} always directly sets the daylight cycle time to the specified number. But {{in|bedrock}}, when {{cd|time: TimeSpec}} is specified, it '''increases''' the daylight cycle time to meet the specified {{cd|time: TimeSpec}}.


For example:
For example:
:{{MC/In|java}}, when executing <code>/time set day</code> or <code>/time set 1000</code>, the daylight cycle time is set to 1000, so the "day" value returns to 0.
:{{IN|java}}, when executing <code>/time set day</code> or <code>/time set 1000</code>, the daylight cycle time is set to 1000, so the "day" value returns to 0.
:{{MC/In|bedrock}}, when executing <code>/time set 1000</code>, the daylight cycle time is also set to 1000. But, for <code>/time set day</code>, if now the daylight cycle time is 25001 (1 day + 1001 ticks), after executing <code>/time set day</code>, it won't become 1000 or 25000, since '''it only increases the daylight cycle time''' when using {{MC/Cd|time: TimeSpec}}. In fact, it turns into 49000 (2 days + 1000 ticks), and the "day" value becomes 2. If now the daylight cycle time is 25000 (1 day + 1000 ticks), after executing <code>/time set day</code>, it remains unchanged.
:{{IN|bedrock}}, when executing <code>/time set 1000</code>, the daylight cycle time is also set to 1000. But, for <code>/time set day</code>, if now the daylight cycle time is 25001 (1 day + 1001 ticks), after executing <code>/time set day</code>, it won't become 1000 or 25000, since '''it only increases the daylight cycle time''' when using {{cd|time: TimeSpec}}. In fact, it turns into 49000 (2 days + 1000 ticks), and the "day" value becomes 2. If now the daylight cycle time is 25000 (1 day + 1000 ticks), after executing <code>/time set day</code>, it remains unchanged.


==Syntax==
==Syntax==
Line 28: Line 28:
: <code>time add <nowiki><time></nowiki></code>
: <code>time add <nowiki><time></nowiki></code>
: <code>time<nowiki/> of <clock> add <ti<nowiki/>me></code>
: <code>time<nowiki/> of <clock> add <ti<nowiki/>me></code>
:: Adds <code><<nowiki/>time></code> to the specified world clock's daylight cycle time.
:: Adds <code><<nowiki/>time></code> to the specified [[Minecraft:world clock]]'s daylight cycle time.
: <code>time pause</code>
: <code>time pause</code>
: <code>time of <clock> pause</code>
: <code>time of <clock> pause</code>
:: Pauses the specified world clock.
:: Pauses the specified world clock.
: <code>time query gametime</code>
: <code>time query gametime</code>
:: Queries the number of game ticks that have passed in the world.
:: Queries the number of [[Minecraft:game tick]]s that have passed in the world.{{note|name=32int}}
: <code>time query time</code>
: <code>time query time</code>
: <code>time of <clock> query time</code>
: <code>time of <clock> query time</code>
Line 43: Line 43:
: <code>time of <clock> query <tim<nowiki/>eline></code>
: <code>time of <clock> query <tim<nowiki/>eline></code>
:: Queries the number of game ticks passed in this repetition of <code><clock></code>'s timeline <code><timelin<nowiki/>e></code>.
:: Queries the number of game ticks passed in this repetition of <code><clock></code>'s timeline <code><timelin<nowiki/>e></code>.
:<code>time rate <rate></code>
: <code>time of <clock> rate <rate></code>
:: Sets the time advancement speed multiplier of the specified world clock.
: <code>time resume</code>
: <code>time resume</code>
: <code>time of <clock> resume</code>
: <code>time of <clock> resume</code>
Line 56: Line 59:
:: Queries current time.
:: Queries current time.
: <code>time set <amount: int></code>
: <code>time set <amount: int></code>
: <code>time set <time: TimeSpec></code>
: <code>time set &lt;time: TimeSpec></code>
:: Sets the daylight cycle time.
:: Sets the daylight cycle time.


==Arguments==
==Arguments==
{{MC/Argument|time|time|amount: int|int}}
{{argument|time|time|amount: int|int}}
: Specifies the time to add or set.
: Specifies the time to add or set.
: {{MC/Arg desc|je=time|min=0|be=int}}
: {{arg desc|je=time|min=0|be=int}}


{{code|daytime{{!}}gametime{{!}}day}}
{{code|daytime{{!}}gametime{{!}}day}}
: Specifies the time to query. Must be <code>daytime</code>, <code>gametime</code> or <code>day</code>.
: Specifies the time to query. Must be <code>daytime</code>, <code>gametime</code> or <code>day</code>.


{{MC/El|je|short=1}}: {{code|day{{!}}night{{!}}noon{{!}}midnight}}<br>
{{el|je|short=1}}: {{code|day{{!}}night{{!}}noon{{!}}midnight}}<br>
{{MC/El|be|short=1}}: {{MC/Argument|be=1|time: TimeSpec|enum}}
{{el|be|short=1}}: {{argument|be=1|time: TimeSpec|enum}}
: Specifies the time to set.
: Specifies the time to set.
: Must be <code>day</code>, <code>night</code>, <code>noon</code>, <code>midnight</code>, <code>sunrise</code>{{only|bedrock}}, or <code>sunset</code>{{only|bedrock}}.
: Must be one of the following:
:* <code>day</code> = 1,000
:* {{EnvSprite|sunrise}} <code>sunrise</code> = 23,000{{only|bedrock}}
:* <code>night</code> = 13,000
:* {{EnvSprite|day}} <code>day</code> = 1,000
:* <code>noon</code> = 6,000
:* {{EnvSprite|noon}} <code>noon</code> = 6,000
:* <code>midnight</code> = 18,000
:* {{EnvSprite|sunset}} <code>sunset</code> = 12,000{{only|bedrock}}
:* <code>sunrise</code> = 23,000{{only|bedrock}}
:* {{EnvSprite|night}} <code>night</code> = 13,000
:* <code>sunset</code> = 12,000{{only|bedrock}}
:* {{EnvSprite|midnight}} <code>midnight</code> = 18,000


{{MC/El|je|short=1}}: {{MC/Argument|clock|resource}}
{{el|je|short=1}}: {{argument|clock|resource}}
: Specifies the world clock to operate on. If not specified ({{MC/Cmd|time|link=none}} instead of {{MC/Cmd|time of <clock>|link=none}}), defaults to the default world clock of the dimension of execution. Currently, only the [[Minecraft:Overworld]] and [[Minecraft:the End]] have default world clocks, which are {{MC/Cd|minecraft:overworld}} and {{MC/Cd|minecraft:the_end}} respectively.
: Specifies the [[Minecraft:world clock]] to operate on. If not specified ({{cmd|time|link=none}} instead of {{cmd|time of <clock>|link=none}}), defaults to the default world clock of the dimension of execution. Currently, only the [[Minecraft:Overworld]] and [[Minecraft:the End]] have default world clocks, which are {{cd|minecraft:overworld}} and {{cd|minecraft:the_end}} respectively.
: Executing without specifying a world clock in a dimension without a default world clock raises an error.
: Executing without specifying a world clock in a dimension without a default world clock raises an error.
: Must be a namespaced [[Minecraft:identifier]] of a registry registered in the {{MC/Cd|minecraft:world_clock}} registry.
: Must be a namespaced [[Minecraft:identifier]] of a registry registered in the {{cd|minecraft:world_clock}} [[Minecraft:registry]].


{{MC/El|je|short=1}}: {{MC/Argument|timemarker|resource}}
{{el|je|short=1}}: {{argument|timemarker|resource}}
: Specifies the time marker to set the time to
: Specifies the time marker to set the time to
: Must be a namespaced identifier. Upon execution, the command either attempts to retrieve an unregistered item based on this identifier, or send it to the client for processing.
: Must be a namespaced identifier. Upon execution, the command either attempts to retrieve an unregistered item based on this identifier, or send it to the client for processing.


{{MC/El|je|short=1}}: {{MC/Argument|timeline|resource}}
{{el|je|short=1}}: {{argument|timeline|resource}}
: Specifies the timeline to query.
: Specifies the timeline to query.
: Must be a namespaced identifier of a registry registered in the {{MC/Cd|minecraft:timeline}} registry.
: Must be a namespaced identifier of a registry registered in the {{cd|minecraft:timeline}} registry.


==Result==
== Result ==
{{MC/Update|In 26.1, there are more errors regarding world clock, such as not specifying one in a dimension without a default world clock. Can someone knowing the difference between unparseable, error, and failed add this?|section=1}}
{{Result table}}
{{Result table}}
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable|unparseable}}
{{Result table|The command is incomplete, or any argument is not specified correctly.|unparseable}}
{{Result table|succeed}}
{{Result table|The specified [[Minecraft:world clock]] does not exist, a default world clock is not available in the current dimension, the specified [[Minecraft:timeline]] does not belong to the specified world clock, the specified time marker does not exist, or the clock is already at the specified time, paused, running, or at the specified rate.|error}}
{{Result table|cmd=|succeed}}
{{Result table}}
{{Result table}}


== Output ==
== Output ==


{{MC/Output table}}
{{Output table}}
{{MC/Output table|cmd=/time add ...<br>/time set ...|edition=je|On success|1|1|the daytime (the daylight cycle time modulo 24000) after execution}}
{{Output table|cmd=/time add ...<br>/time set ...|edition=je|On success|1|1|the daytime (the daylight cycle time modulo 24000) after execution}}
{{MC/Output table|cmd=/time query ...|On success|1|1|the obtained value}}
{{Output table|cmd=/time query ...|On success|1|1|the obtained value}}
{{MC/Output table|cmd=|edition=be|On fail|0}}
{{Output table|cmd=|edition=be|On fail|0}}
{{MC/Output table|On success|1}}
{{Output table|On success|1}}
{{MC/Output table}}
{{Output table}}


==Examples==
==Examples==


* To set the daylight cycle time to 1,000: <code>time set 1000</code>
* To set the daylight cycle time to 1,000: <code>time set 1000</code>
* To add one day to the daylight cycle time: <code>time add 24000</code>
* To add one [[Minecraft:day]] to the daylight cycle time: <code>time add 24000</code>
* To change/reset in-game day count to desired number: <code>time set <desired day number*24000+time of day in ticks></code>; to change day count to day 472 at noon (6000): <code>time set 11334000</code>
* To change/reset in-game day count to desired number: <code>time set <desired day number*24000+time of day in ticks></code>; to change day count to day 472 at noon (6000): <code>time set 11334000</code>


Line 116: Line 119:
=== ''Java Edition'' ===
=== ''Java Edition'' ===
{{HistoryTable
{{HistoryTable
|{{MC/HistoryLine|java beta}}
|{{HistoryLine|java beta}}
|{{HistoryLine||1.3|Added {{MC/Cmd|time|link=none}}.  Both <code>add</code> and <code>set</code> can be used.}}
|{{HistoryLine||1.3|Added {{cmd|time|link=none}}.  Both <code>add</code> and <code>set</code> can be used.}}
|{{MC/HistoryLine|java}}
|{{HistoryLine|java}}
|{{HistoryLine||1.3.1|dev=12w16a|{{MC/Cmd|time|link=none}} is now usable in singleplayer.
|{{HistoryLine||1.3.1|dev=12w16a|{{cmd|time|link=none}} is now usable in singleplayer.
|{{MC/Cmd|time set|link=none}} now accepts <code>day</code> (equivalent to 0) and <code>night</code> (equivalent to 12500).}}
|{{cmd|time set|link=none}} now accepts <code>day</code> (equivalent to 0) and <code>night</code> (equivalent to 12500).}}
|{{HistoryLine||1.7.2|dev=13w36a|{{MC/Cmd|time set day|link=none}} now is equivalent to 1000, and {{MC/Cmd|time set night|link=none}} now is equivalent to 13000.}}
|{{HistoryLine||1.7.2|dev=13w36a|{{cmd|time set day|link=none}} now is equivalent to 1000, and {{cmd|time set night|link=none}} now is equivalent to 13000.}}
|{{HistoryLine||1.8|dev=14w29a|Added {{MC/Cmd|time query|link=none}}, accepting <code>daytime</code> and <code>gametime</code>.}}
|{{HistoryLine||1.8|dev=14w29a|Added {{cmd|time query|link=none}}, accepting <code>daytime</code> and <code>gametime</code>.}}
|{{HistoryLine||1.9|dev=15w49b|{{MC/Cmd|time query|link=none}} now accepts {{MC/Cd|day}} as a value.}}
|{{HistoryLine||1.9|dev=15w49b|{{cmd|time query|link=none}} now accepts {{cd|day}} as a value.}}
|{{HistoryLine||1.13|dev=18w01a|Added the options {{MC/Cd|noon}} and {{MC/Cd|midnight}} to {{MC/Cmd|time set|link=none}}.}}
|{{HistoryLine||1.13|dev=18w01a|Added the options {{cd|noon}} and {{cd|midnight}} to {{cmd|time set|link=none}}.}}
|{{HistoryLine||26.1|dev=snap3|The {{MC/Cmd|time}} command is now based on world clocks.|The return value (e.g. from {{MC/Cmd|execute store}}) from the {{MC/Cd|set}} and {{MC/Cd|add}} subcommands is now the total elapsed ticks of the clock instead of the current time of day.}}
|{{HistoryLine||26.1|dev=snap3|The {{cmd|time}} command is now based on world clocks.|The return value (e.g. from {{cmd|execute store}}) from the {{cd|set}} and {{cd|add}} subcommands is now the total elapsed ticks of the clock instead of the current time of day.}}
|{{HistoryLine|||dev=pre1|Added {{MC/Cmd|time [of <clock>] rate <rate>}}.}}
|{{HistoryLine|||dev=pre1|Added {{cmd|time [of <clock>] rate <rate>}}.}}
}}
}}


=== ''Bedrock Edition'' ===
=== ''Bedrock Edition'' ===
{{HistoryTable
{{HistoryTable
|{{MC/HistoryLine|pocket alpha}}
|{{HistoryLine|pocket alpha}}
|{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|time|link=none}}.}}  
|{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|time|link=none}}.}}  
|{{MC/HistoryLine|bedrock}}
|{{HistoryLine|bedrock}}
|{{HistoryLine||1.17.30|dev=beta 1.17.30.20|Now {{MC/Cd|/time set <amount: int>}} directly sets the daylight cycle time to the specified number, instead of incrementing the daylight cycle time to satisfy the specified daytime.}}  
|{{HistoryLine||1.17.30|dev=beta 1.17.30.20|Now {{cd|/time set <amount: int>}} directly sets the daylight cycle time to the specified number, instead of incrementing the daylight cycle time to satisfy the specified daytime.}}
|{{HistoryLine|upcoming Bedrock}}
|{{HistoryLine||26.50|dev=Preview 26.50.26|exp=Creator World Clocks Features|Added {{cmd|time of}} for modifying world clocks.|Supports {{cd|add}}, {{cd|set}}, {{cd|pause}}, {{cd|resume}} and {{cd|query time}}. {{cd|set}} can also target a time marker.}}
}}
}}
== Notes ==
{{notelist}}


== External links ==
== External links ==
* {{Cite|url=https://learn.microsoft.com/en-us/minecraft/creator/commands/commands/time?view=minecraft-bedrock-stable|title=<code>/time</code> Command|website=Microsoft Learn|date=October 11, 2023}}
* {{Cite|url=https://learn.microsoft.com/en-us/minecraft/creator/commands/commands/time?view=minecraft-bedrock-stable|title=<code>/time</code> Command|website=Microsoft Learn|date=October 11, 2023}}


== Navigation ==
== Navigation ==
{{MC/Navbox commands}}
{{Navbox commands}}


de:Befehl/time
[[Minecraft:de:Befehl/time]]
es:Comandos/time
[[Minecraft:es:Comandos/time]]
ja:コマンド/time
[[Minecraft:fr:Commandes/time]]
pt:Comandos/time
[[Minecraft:ja:コマンド/time]]
ru:Команды консоли/time
[[Minecraft:pt:Comandos/time]]
uk:Команди консолі/time
[[Minecraft:ru:Команды консоли/time]]
zh:命令/time
[[Minecraft:uk:Команди консолі/time]]
[[Minecraft:zh:命令/time]]

Latest revision as of 11:09, 19 August 2026

Template:Infobox command

Changes or queries the Minecraft:world's game Minecraft:time or the time of a Minecraft:world clock.

Usage

There are four types of time involved in this command:

  • Gametime - The total number of Minecraft:game ticks that have elapsed in the world.Template:Note
  • Daylight cycle time (aka. internal daytime) - The total number of game ticks that have elapsed during the daylight cycle. It does not elapse when the game rule Template:Gmr is false.
  • Daytime - The number of game ticks that have elapsed since sunrise on current day. It is the result of dividing the daylight cycle time modulo 24,000.
  • Day - The number of days that have elapsed during the daylight cycle. It is the result of floor division by 24,000 of the daylight cycle time.

Template:IN, if the world is frozen by the Template:Cmd command, the four times above do not elapse.

/time set ... command Template:In always directly sets the daylight cycle time to the specified number. But Template:In, when Template:Cd is specified, it increases the daylight cycle time to meet the specified Template:Cd.

For example:

Template:IN, when executing /time set day or /time set 1000, the daylight cycle time is set to 1000, so the "day" value returns to 0.
Template:IN, when executing /time set 1000, the daylight cycle time is also set to 1000. But, for /time set day, if now the daylight cycle time is 25001 (1 day + 1001 ticks), after executing /time set day, it won't become 1000 or 25000, since it only increases the daylight cycle time when using Template:Cd. In fact, it turns into 49000 (2 days + 1000 ticks), and the "day" value becomes 2. If now the daylight cycle time is 25000 (1 day + 1000 ticks), after executing /time set day, it remains unchanged.

Syntax

  • Java Edition
time add <time>
time of <clock> add <time>
Adds <time> to the specified Minecraft:world clock's daylight cycle time.
time pause
time of <clock> pause
Pauses the specified world clock.
time query gametime
Queries the number of Minecraft:game ticks that have passed in the world.Template:Note
time query time
time of <clock> query time
Queries the number of game ticks that have passed in a <clock>.
time query <timeline> repetition
time of <clock> query <timeline> repetition
Queries the number of repetitions that have passed using <clock>'s timeline <timeline>.
time query <timeline>
time of <clock> query <timeline>
Queries the number of game ticks passed in this repetition of <clock>'s timeline <timeline>.
time rate <rate>
time of <clock> rate <rate>
Sets the time advancement speed multiplier of the specified world clock.
time resume
time of <clock> resume
Resumes the specified world clock
time set (<time>|<timemarker>)
time of <clock> set (<time>|<timemarker>)
Sets the specified world clock's daylight cycle time to the specified time or time marker (Template:Cd.
  • Bedrock Edition
time add <amount: int>
Adds <time> to the daylight cycle time.
time query <daytime|gametime|day>
Queries current time.
time set <amount: int>
time set <time: TimeSpec>
Sets the daylight cycle time.

Arguments

Template:Argument

Specifies the time to add or set.
Template:Arg desc

Template:Code

Specifies the time to query. Must be daytime, gametime or day.

Template:El: Template:Code
Template:El: Template:Argument

Specifies the time to set.
Must be one of the following:

Template:El: Template:Argument

Specifies the Minecraft:world clock to operate on. If not specified (Template:Cmd instead of Template:Cmd), defaults to the default world clock of the dimension of execution. Currently, only the Minecraft:Overworld and Minecraft:the End have default world clocks, which are Template:Cd and Template:Cd respectively.
Executing without specifying a world clock in a dimension without a default world clock raises an error.
Must be a namespaced Minecraft:identifier of a registry registered in the Template:Cd Minecraft:registry.

Template:El: Template:Argument

Specifies the time marker to set the time to
Must be a namespaced identifier. Upon execution, the command either attempts to retrieve an unregistered item based on this identifier, or send it to the client for processing.

Template:El: Template:Argument

Specifies the timeline to query.
Must be a namespaced identifier of a registry registered in the Template:Cd registry.

Result

Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table

Output

Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table

Examples

  • To set the daylight cycle time to 1,000: time set 1000
  • To add one Minecraft:day to the daylight cycle 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

Template:HistoryTable

Bedrock Edition

Template:HistoryTable

Notes

Template:Notelist

External links

Navigation

Template:Navbox commands

Minecraft:de:Befehl/time Minecraft:es:Comandos/time Minecraft:fr:Commandes/time Minecraft:ja:コマンド/time Minecraft:pt:Comandos/time Minecraft:ru:Команды консоли/time Minecraft:uk:Команди консолі/time Minecraft:zh:命令/time