This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Nothy's profile picture

Proper 24-hour time format.

Started by Nothy, 03 March 2016 - 10:40 AM
Nothy #1
Posted 03 March 2016 - 11:40 AM
Basically fixing the fact that when using 24-hour time format (textutils api)
When the time is for example 1:04 AM, it will show 1:04 instead of 01:04, which is insanely irritating.

And it would be easier to have since it will have the same text size all the time, so you don't have to allocate more space to compensate for the fact that it will move when going from 9:59 to 10:00.

It's just my opinion though. I'm sure you could compensate for this, but I'm lazy and would rather see it implemented as I'm sure it would help a lot of people.
Goof #2
Posted 03 March 2016 - 04:07 PM
Yeah, This is really annoying for me aswell.
I know. It can be done with custom functions, but i hope this suggestion is up for being added in a future update.
Edited on 03 March 2016 - 03:07 PM
PixelToast #3
Posted 03 March 2016 - 10:44 PM
i dont know, here in the US we do 1:04 instead of 01:04
and google seems to agree http://i.imgur.com/IEID4BK.png http://i.imgur.com/S7eDKQQ.png

because im used to seeing it this way, the added 0 makes it less readable
MKlegoman357 #4
Posted 04 March 2016 - 06:19 AM
I like the current format too.
Nothy #5
Posted 04 March 2016 - 11:11 AM
i dont know, here in the US we do 1:04 instead of 01:04
and google seems to agree http://i.imgur.com/IEID4BK.png http://i.imgur.com/S7eDKQQ.png

because im used to seeing it this way, the added 0 makes it less readable
But in Europe we use military time, which means that midnight is 0000, or 00:00. And it's really irritating to have to program something just to add a 0.

And google does not agree, I guess it is based on time zones. http://i.imgur.com/hb6WiQo.png
HPWebcamAble #6
Posted 04 March 2016 - 10:43 PM
A quick search on Google Images for military time turns up results that mostly add the 0 before times like 1:00

But it is technically still 'correct' with or without the zero, since adding a zero simply changes the look, not the time shown.


And google does not agree, I guess it is based on time zones. http://i.imgur.com/hb6WiQo.png

Um.. what? PixelToast was showing that Google doesn't add the 0, that time would never have a 0 at the beginning anyway.
MKlegoman357 #7
Posted 05 March 2016 - 07:22 AM
Why does everyone keep refering to it as "military time"? It's simply a 24-hour format.
KingofGamesYami #8
Posted 05 March 2016 - 01:14 PM
Why does everyone keep refering to it as "military time"? It's simply a 24-hour format.

In the United States, the military uses 24 hour format. Everyone else uses 12 hour.
wilcomega #9
Posted 05 March 2016 - 04:23 PM
24 hour master race! why use the same number twice when we (europeans) are clearly smart enough to remember more numbers than 24! i know right! its crazy!
KingofGamesYami #10
Posted 05 March 2016 - 06:55 PM
24 hour master race! why use the same number twice when we (europeans) are clearly smart enough to remember more numbers than 24! i know right! its crazy!

Yeah, we had to make room for all the imperial unit conversions. (We learn metric anyway… go figure)
manu_03 #11
Posted 05 March 2016 - 08:18 PM
I don't know in other european countries, but in Spain we refer to 16:00 / 4:00 PM as "las 4 de la tarde" (lit. "4 o' clock in the afternoon"), but most clocks here use 24-hour/military time, it uses less space but it's well readable. For example, my hand watch doesn't use the 0, but it puts the hour 1 space right [16:00] [ 8:00]
wilcomega #12
Posted 06 March 2016 - 04:03 PM
I don't know in other european countries, but in Spain we refer to 16:00 / 4:00 PM as "las 4 de la tarde" (lit. "4 o' clock in the afternoon"), but most clocks here use 24-hour/military time, it uses less space but it's well readable. For example, my hand watch doesn't use the 0, but it puts the hour 1 space right [16:00] [ 8:00]

same for most european countries i have been to, i live in the Netherlands
gril002 #13
Posted 07 April 2016 - 05:04 PM
Yeah the 24 hour format is just military time which should be 05:30. I am guessing you americans are using the AM/PM sistem most of the time anyway…. so please add the 0
moTechPlz #14
Posted 07 April 2016 - 05:49 PM
Why not just rewrite the format code from textutils?


function formatTime24h( nTime )
  local nHour = math.floor( nTime )
  local nMinute = math.floor( ( nTime - nHour ) * 60 )
  return string.format( "%02d:%02d", nHour, nMinute )
end
Edited on 07 April 2016 - 03:51 PM
Nothy #15
Posted 08 April 2016 - 12:58 PM
Why not just rewrite the format code from textutils?


function formatTime24h( nTime )
  local nHour = math.floor( nTime )
  local nMinute = math.floor( ( nTime - nHour ) * 60 )
  return string.format( "%02d:%02d", nHour, nMinute )
end
Why not just add it into CC as a native thing?
EveryOS #16
Posted 08 April 2016 - 06:24 PM
Just use tostring and string.len. I did that.
TheRockettek #17
Posted 09 April 2016 - 03:03 PM
Bai post…
Edited on 15 April 2016 - 06:56 PM
TheRockettek #18
Posted 09 April 2016 - 03:09 PM
i dont know, here in the US we do 1:04 instead of 01:04
and google seems to agree http://i.imgur.com/IEID4BK.png http://i.imgur.com/S7eDKQQ.png

because im used to seeing it this way, the added 0 makes it less readable

It depends where you are in the world that it decides 12/24 hour clock. For example when i google 'time'



Its in 24 hour