textutils.formatTime
From ComputerCraft Wiki
Function textutils.formatTime | |
Takes input time and formats it in a more readable format. If the second value is true, returns time in twenty-four hour format; if the second value is false, returns time in twelve-hour format, with AM or PM. Default for twentyFourHour is false. | |
Syntax | textutils.formatTime(number time, boolean twentyFourHour) |
Returns | string formatted time |
Part of | ComputerCraft |
API | textutils |
Examples
Example | |
Prints the Minecraft world time in 12-hour time. | |
Code |
print( textutils.formatTime( os.time(), false ) ) |
Output | Depends on the time of day in your world, it will look something like this: "5:30 AM". |
Example | |
Prints the Minecraft world time in 24-hour time. | |
Code |
print( textutils.formatTime( os.time(), true ) ) |
Output | Depends on the time of day in your world, it will look something like this: "17:30". |