I am trying to parse this date "18th of June 2016. Saturday" to "18/06/2016" I'm aware this can be done using the regex method but I'm not sure how you'd get an output using that.
A method using NSDateFormatter in swift would be preferred
I am trying to parse this date "18th of June 2016. Saturday" to "18/06/2016" I'm aware this can be done using the regex method but I'm not sure how you'd get an output using that.
A method using NSDateFormatter in swift would be preferred
Here you go.
NSDateFormatter
does not support days with ordinal indicators, so you have to get rid of them. You can use regex:then you simply format the date.
Complete code:
Keep in mind that
NSNumberFormatter
will format according to the current locale settings.