NSDateformatter setDateFormat according to currentLocale

前端 未结 6 2136
孤城傲影
孤城傲影 2021-02-14 12:17

I\'m going mad with, probably, a stupid problem.

I have 3 strings: year, month and day. I need to have a date in the right format based on currentLocale, so i.e. if curr

6条回答
  •  孤城傲影
    2021-02-14 12:34

    Look at NSDateComponents to create an NSDate, then use NSDateFormatter to format it. NSDateFormatter uses the current locale to format dates, based on the format style (e.g.
    NSDateFormatterMediumStyle).

提交回复
热议问题