Difference between revisions of "Textutils.formatTime"
From ComputerCraft Wiki
(Added new page for textutils.formatTime()) |
|||
| Line 9: | Line 9: | ||
|examples= | |examples= | ||
{{Example | {{Example | ||
| − | |desc=Prints the | + | |desc=Prints the Minecraft world time in 12-hour time. |
|code=print(textutils.formatTime(os.clock(), false)) | |code=print(textutils.formatTime(os.clock(), false)) | ||
| − | |output=Depends on the time of day in your world, | + | |output=Depends on the time of day in your world, it will look something like this: "5:30 AM". |
}} | }} | ||
{{Example | {{Example | ||
| − | |desc=Prints the | + | |desc=Prints the Minecraft world time in 24-hour time. |
|code=print(textutils.formatTime(os.clock(), true)) | |code=print(textutils.formatTime(os.clock(), true)) | ||
| − | |output=Depends on the time of day in your world, | + | |output=Depends on the time of day in your world, it will look something like this: "17:30". |
}} | }} | ||
}} | }} | ||
Revision as of 00:01, 18 September 2012
| Formats a time that is in float format. | |
| Syntax | textutils.formatTime(float time, boolean isTwentyFourHour) |
| Returns | string formatted time |
| Part of | ComputerCraft |
| API | textutils |
Examples
| Prints the Minecraft world time in 24-hour time. | |
| Code |
print(textutils.formatTime(os.clock(), true)) |
| Output | Depends on the time of day in your world, it will look something like this: "17:30". |