9

In the ISO-8601 there are multiple hour formats, one of them is "kk" for hours 1-24.

What is the purpose of this? Are there countries that offset their time? Is it for military usages?

The wikipedia article didn't clarify the exact nature between HH and kk. The main source of my concern is the behaviour of the formats in SimpleDataFormatter.

Edit: The direct part from the SimpleDateFormat that I'm referring to is this:

H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24

In usage...

HH:mm:ss  // 00:00:00
kk:mm:ss  // 01:00:00
  • 4
    kk is not HH+1. – Ordous Oct 7 '15 at 13:50
  • 1
    Without a snippet of the section you are referring to, it is difficult to answer this question. – GlenH7 Oct 7 '15 at 13:50
  • 4
    kk expresses midnight as 24:00, rather 00:00. It's only use is in timetables and schedules to denote that something ends at midnight (simple.wikipedia.org/wiki/24-hour_clock), it would typically be used to express an end time in a time range. – David Arno Oct 7 '15 at 13:56
  • 5
    Your usage example is incorrect. kk:mm:ss will be 24:00:00 in your example. – David Arno Oct 7 '15 at 13:58
  • +1 because I cannot see why this question needed to be downvoted – ooxi Oct 7 '15 at 16:17
2

Direct answer to your question, there is no difference. The point is you do not need to do the +1 computation by using kk. My source can be found at: http://www-01.ibm.com/support/knowledgecenter/SSKM8N_8.0.0/com.ibm.etools.mft.doc/ak05616_.htm?lang=pt

Here you find this description:

HH hour of day in 24 hour form (00-23) kk hour of day in 24 hour form (01-24)

Now, regarding HH+1 = kk. Example: HH: 00 in kk is 01. You can do this for each of the values.

As for the usage, it is for i18n purposes or different usages as you already mentioned. In different parts of world, different notations are used. But normally, you would only use kk in situations in which you have business hours which goes beyond or after 24 hours. For example, TV stations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.