1
\$\begingroup\$

This question already has an answer here:

For some part of history people in France used a decimal clock. with the clock having 10 hour day, 100 minutes an hour and 100 seconds per minute. Though this clock simplified calculations a bit the idea wasn't appreciated by most of the world which used our current 24 hour, 60 minute hour, and 60 second minute. And hence decimal time was scrapped

However this time system does have its merits too. It is very useful for calculating time based efficiency easily aligns with our decimal measurement system and etc.

So given an Input as a string which is in standard HH:MM:SS format (regular time) we have to convert it to decimal time and output the exact decimal time on screen

Rules:

  1. You will be provided with a string of the 24 hour format with colon separator between different time units Eg: 06:00:00,18:00:00
  2. Your output must be a string of decimal time of the format as in 02:50:00, 07:50:00.
  3. Note that separators in the output do not matter. Eg: 02:50:00 is a valid output and so is 02#50#00 (replacing separator colons with hashtags does not change output validity)
  4. No use of any time related module is allowed. You will be provided input as specified in Rule 1 (#include, import datetime etc. is not allowed)

Who is the winner:

The one whose code is smallest wins

Sample input ----> Output

00:00:00 changes to 00:00:00
06:00:00 changes to 02:50:00
06:30:00 changes to 02:70:83
12:00:00 changes to 05:00:00
18:00:00 changes to 07:50:00
18:30:00 changes to 07:70:83
\$\endgroup\$

marked as duplicate by Erik the Outgolfer, JungHwan Min, pajonk, Digital Trauma code-golf Mar 8 '17 at 16:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \$\begingroup\$ Hi there! I like this challenge, but I have a question about the input/output format. Does it need to be a strict HH:MM:SS string, or can the code take input as, e.g., an array [hh, mm, ss]? The reason I ask is that as-is, it makes input parsing a large portion of the code. \$\endgroup\$ – AdmBorkBork Mar 8 '17 at 15:57
  • \$\begingroup\$ "No use of any time related module is allowed" -- How do you define "time-related?" \$\endgroup\$ – JungHwan Min Mar 8 '17 at 15:57
  • \$\begingroup\$ @JungHwanMin Somewhat related, definitely not a duplicate. \$\endgroup\$ – AdmBorkBork Mar 8 '17 at 16:02
  • 1
    \$\begingroup\$ @AdmBorkBork The challenge I linked requires the code to output the decimal time too, but the output has to be a decimal number. This challenge just formats the decimal number. I'd say they are duplicates, as you can pretty much copy the code from the other challenge, only adding the formatting part. \$\endgroup\$ – JungHwan Min Mar 8 '17 at 16:06
  • \$\begingroup\$ 06:30:00 changes to 03:00:00 ... 06:30:00 changes to 08:00:00 Which one is correct? Shouldn't the output be 02:70:83? \$\endgroup\$ – JungHwan Min Mar 8 '17 at 16:07

Browse other questions tagged or ask your own question.