Is 12:01:00A.M in DataFormatter.localizedString correct?


(Zhao Xin) #1

It should be called 00:01:00 A.M., instead of 12:01:00 A.M. Shouldn't it?

import Foundation

let now = Date()

var dc = Calendar.current.dateComponents([.year, .month, .day], from: now)

dc.minute = 1

let date = Calendar.current.date(from: dc)

print(DateFormatter.localizedString(from: date!, dateStyle: .long,
timeStyle: .long))

// prints "August 29, 2016 at 12:01:00 AM GMT+8"

Zhaoxin


(Jacob Bandes-Storch) #2

12:01 AM is the correct way of writing "one minute past midnight" in 12-hr
time.

···

On Sun, Aug 28, 2016 at 9:15 PM, Zhao Xin via swift-users < swift-users@swift.org> wrote:

It should be called 00:01:00 A.M., instead of 12:01:00 A.M. Shouldn't it?

import Foundation

let now = Date()

var dc = Calendar.current.dateComponents([.year, .month, .day], from: now)

dc.minute = 1

let date = Calendar.current.date(from: dc)

print(DateFormatter.localizedString(from: date!, dateStyle: .long,
timeStyle: .long))

// prints "August 29, 2016 at 12:01:00 AM GMT+8"

Zhaoxin

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Saagar Jha) #3

24 hour time shouldn’t need an AM/PM indicator.

Saagar Jha

···

On Aug 28, 2016, at 21:15, Zhao Xin via swift-users <swift-users@swift.org> wrote:

It should be called 00:01:00 A.M., instead of 12:01:00 A.M. Shouldn't it?

import Foundation

let now = Date()
var dc = Calendar.current.dateComponents([.year, .month, .day], from: now)
dc.minute = 1
let date = Calendar.current.date(from: dc)
print(DateFormatter.localizedString(from: date!, dateStyle: .long, timeStyle: .long))
// prints "August 29, 2016 at 12:01:00 AM GMT+8"

Zhaoxin
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Jens Alfke) #4

Weird; that seems like a useless complication to add.

There’s really no ambiguity about 12:00 AM/PM. AM and PM toggle the instant the clock strikes 12. So “12:00 AM” is midnight because the time just flipped from PM to AM.

—Jens [a US resident who admits 12-hour time is ungainly, but finds 24-hour time cold and soulless]

···

On Aug 28, 2016, at 10:19 PM, Michael Nisi via swift-users <swift-users@swift.org> wrote:

The 12-hour clock will always remain a mystery to me https://en.wikipedia.org/wiki/12-hour_clock

“Likewise, some U.S. style guides recommend either clarifying "midnight" with other context clues, such as specifying the two dates between which it falls, or not referring to midnight at all. For an example of the latter method, "midnight" is replaced with "11:59 p.m." for the end of a day or "12:01 a.m." for the start of a day.


(Michael Nisi) #5

The 12-hour clock will always remain a mystery to me
https://en.wikipedia.org/wiki/12-hour_clock

“Likewise, some U.S. style guides recommend either clarifying "midnight"
with other context clues, such as specifying the two dates between which it
falls, or not referring to midnight at all. For an example of the latter
method, "midnight" is replaced with "11:59 p.m." for the end of a day or
"12:01 a.m." for the start of a day. That has become common in the United
States in legal contracts and for airplane, bus, or trainschedules, though
some schedules use other conventions. Occasionally, when trains run at
regular intervals, the pattern may be broken at midnight by displacing the
midnight departure one or more minutes, such as to 23:59 or 00:01.”

Michael

···

On Mon, Aug 29, 2016 at 6:15 AM, Zhao Xin via swift-users < swift-users@swift.org> wrote:

It should be called 00:01:00 A.M., instead of 12:01:00 A.M. Shouldn't it?

import Foundation

let now = Date()

var dc = Calendar.current.dateComponents([.year, .month, .day], from: now)

dc.minute = 1

let date = Calendar.current.date(from: dc)

print(DateFormatter.localizedString(from: date!, dateStyle: .long,
timeStyle: .long))

// prints "August 29, 2016 at 12:01:00 AM GMT+8"

Zhaoxin

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Zhao Xin) #6

But the beginning of AM/PM is 12, and the end is 11, which is odd to me. I now think the model as a real clock on the wall which use Rome numbers, there are III, VI, IX and XII. So definetly there is no zero hour on the clock. Thanks all.

Zhaoxin

···

Get Outlook for iOS

On Mon, Aug 29, 2016 at 2:53 PM +0800, "Jens Alfke" <jens@mooseyard.com> wrote:

On Aug 28, 2016, at 10:19 PM, Michael Nisi via swift-users <swift-users@swift.org> wrote:
The 12-hour clock will always remain a mystery to me https://en.wikipedia.org/wiki/12-hour_clock

“Likewise, some U.S. style guides recommend either clarifying "midnight" with other context clues, such as specifying the two dates between which it falls, or not referring to midnight at all. For an example of the latter method, "midnight" is replaced with "11:59 p.m." for the end of a day or "12:01 a.m." for the start of a day.
Weird; that seems like a useless complication to add.
There’s really no ambiguity about 12:00 AM/PM. AM and PM toggle the instant the clock strikes 12. So “12:00 AM” is midnight because the time just flipped from PM to AM.
—Jens [a US resident who admits 12-hour time is ungainly, but finds 24-hour time cold and soulless]


(Jon Shier) #7

The ambiguity isn’t the 11 or 12 but what “midnight” refers to. If you say midnight the 30th, what time is that? That’s the issue the style guides are trying to clarify.

Jon

···

On Aug 29, 2016, at 2:53 AM, Jens Alfke via swift-users <swift-users@swift.org> wrote:

On Aug 28, 2016, at 10:19 PM, Michael Nisi via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

The 12-hour clock will always remain a mystery to me https://en.wikipedia.org/wiki/12-hour_clock

“Likewise, some U.S. style guides recommend either clarifying "midnight" with other context clues, such as specifying the two dates between which it falls, or not referring to midnight at all. For an example of the latter method, "midnight" is replaced with "11:59 p.m." for the end of a day or "12:01 a.m." for the start of a day.

Weird; that seems like a useless complication to add.

There’s really no ambiguity about 12:00 AM/PM. AM and PM toggle the instant the clock strikes 12. So “12:00 AM” is midnight because the time just flipped from PM to AM.

—Jens [a US resident who admits 12-hour time is ungainly, but finds 24-hour time cold and soulless]
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Zhao Xin) #8

Thank you, Jacob. It really was not what I expected. But I will remember it.

Zhaoxin

···

On Mon, Aug 29, 2016 at 12:16 PM, Jacob Bandes-Storch <jtbandes@gmail.com> wrote:

12:01 AM is the correct way of writing "one minute past midnight" in 12-hr
time.

On Sun, Aug 28, 2016 at 9:15 PM, Zhao Xin via swift-users < > swift-users@swift.org> wrote:

It should be called 00:01:00 A.M., instead of 12:01:00 A.M. Shouldn't it?

import Foundation

let now = Date()

var dc = Calendar.current.dateComponents([.year, .month, .day], from: now
)

dc.minute = 1

let date = Calendar.current.date(from: dc)

print(DateFormatter.localizedString(from: date!, dateStyle: .long,
timeStyle: .long))

// prints "August 29, 2016 at 12:01:00 AM GMT+8"

Zhaoxin

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users