[swift-users] Is 12:01:00A.M in DataFormatter.localizedString correct?

Michael Nisi michael.nisi at gmail.com
Mon Aug 29 00:19:56 CDT 2016


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 at 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 at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160829/1318e0a4/attachment.html>


More information about the swift-users mailing list