Open kas-kad opened 9 years ago
Because I wanted to support multiple date/time formats (check enums: ISO8601DateStyle, ISO8601TimeStyle, ISO8601TimeZoneStyle, ISO8601FractionSeparator)
ok, why not this:
let df = NSDateFormatter()
df.locale = NSLocale(localeIdentifier: "en_US_POSIX")
var dayDateFormat: String!
switch dateStyle {
case .CalendarLongStyle:
dayDateFormat = "YYYY-MM-DD"
case .CalendarShortStyle:
dayDateFormat = "YYYYMMDD"
...
}
var timeFormat: String!
switch timeStyle {
case .LongStyle:
timeFormat = "hh:mm:ss"
...
}
df.dateFormat = dayDateFormat +"T"+ timeFormat
I just don't understand why reinvent NSDateFormatter? Just give the case when NSDateFormatter lose the battle. Sorry if I'm busily.
You may find my question kinda silly, but.. Why not just use standard NSDateFormatter? What is the purpose of the ISO8601Formatter?