[swift-users] DateFormatter crash on second usage (new instance) on Linux (swift 3.0.1)
Zhao Xin
owenzx at gmail.com
Wed Jan 25 19:18:03 CST 2017
That why I am choosing to use an IDE. It shows the typos.
Zhaoxin
On Thu, Jan 26, 2017 at 7:53 AM, Michael Bauer via swift-users <
swift-users at swift.org> wrote:
>
>
> On Jan 25, 2017, at 5:04 PM, Dennis Schafroth via swift-users <
> swift-users at swift.org> wrote:
>
> Hi
>
> Trying to do some simple date parsing from syslog format (“Jan 25
> 20:21:22”) into Date. Seem to work once but crashes on second call
>
>
> func dateConv(_ dateString: String) -> Date? {
> let dateFormatter = DateFormatter()
> dateFormatter.dateFormat = "MMM dd HH:mm"
> dateFormatter.locale = Locale(identifier: "da_DK_POSIX")
> if let date = dateFormatter.date(from: dateString) {
> print("Real date: \(date)" )
> return date
> }
> return nil
> }
>
> var date = dateConv("Jan 25 20:10")
> var date2 = dateConv("Jan 25 20:11”)
>
>
>
> Check out your parentheses. The last one is a right curly quote not the
> straight ascii quote that it should be.
>
>
> _______________________________________________
> 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/20170126/bdb8f957/attachment.html>
More information about the swift-users
mailing list