I have an array
of NSDate
objects that I'm trying to convert to a string
. My way of converting them is with NSDateFormat
, but, if there's another better way, I'd be happy to hear.
The most things a date
would have is:
Days-Hours-Minutes-Seconds-Milliseconds
But some will have less, like:
Minutes-Seconds-Milliseconds
Or even less. Now I will have to convert them to a string
. Would I have to create if statements
to determine if it has days, hours, and so on, or is there an easier way of doing this?
Example using
NSDataDetector
(Swift 2.0):Output: