textutils.formatTime

From ComputerCraft
Jump to: navigation, search

textutils.formatTime
Function
Syntax
textutils.formatTime()
Returns string
API textutils
Source CC:Tweaked (source)

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".

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