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

Zhao Xin owenzx at gmail.com
Sun Aug 28 23:37:04 CDT 2016


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 at 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 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/f036759d/attachment.html>


More information about the swift-users mailing list