String description of NSDate

前端 未结 4 1983
星月不相逢
星月不相逢 2021-01-31 10:30

I have the following code:

[ [NSDate date] descriptionWithLocale: @\"yyyy-MM-dd\" ]

I want it to return a date in the following format: \"2009-

4条回答
  •  星月不相逢
    2021-01-31 11:29

    Also note that for most cases, NSDateFormatter is to be preferred for its flexibility.

    There's also a significant performance benefit to be had from re-use of date formatters in many apps.

提交回复
热议问题