textutils.formatTime

Formats time (in ticks) in a human-readable format such as "6:30 PM". If twentyFourHour is set to true, the AM/PM prefix is omitted, and the time is presented in a 24-hour format such as "18:30".

ExampleWith 12-hour format
Prints the Minecraft world time in a 12-hour human-readable format.
Code
<nowiki>
print(textutils.formatTime(os.time()))
    </nowiki>
Output Depends on the world time, for example "6:30 PM".
ExampleWith 24-hour format
Prints the Minecraft world time in a 24-hour human-readable format.
Code
<nowiki>
print(textutils.formatTime(os.time(), true))
    </nowiki>
Output Depends on the world time, for example "18:30".

textutils.formatTime
Function
Syntax
textutils.formatTime(
  • time : number
  • twentyFourHour? : boolean
)

Returns string
API textutils
Source CC:Tweaked (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.