خرید بک لینک

Vote count: 0

I have the code to convert a string to a date as:

            let dateString = detailData.value["eventStart"] as! String
            print(dateString)

            let dateFormatter = NSDateFormatter()
            dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss Z" /*find out and place date format from http://userguide.icu-project.org/formatparse/datetime*/
            let date = dateFormatter.dateFromString(dateString)   // ||  date!.timeIntervalSince1970 >= presentDate.timeIntervalSince1970

            print(date?.timeIntervalSince1970)

The output is:

2016-05-31 03:18:11 +0000
Optional(1464664691.0)

2016-06-03 14:00:44 +0000
nil

2016-06-01 00:38:08 +0000
Optional(1464741488.0)

2016-06-04 00:25:55 +0000
Optional(1464999955.0)

2016-05-31 22:19:54 +0000
nil

I see that the time in the afteoon (is 12+) retu nil.

How can I prevent this?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 12 خرداد 1395 ساعت: 8:51

صفحه بندی