NSDateFormatter dateFromString

前端 未结 2 1593
暗喜
暗喜 2021-01-05 07:33

The string which comes from my data source is formatted like this:

2011-04-11 23:12:05

// dateString comes from my data          


        
2条回答
  •  醉梦人生
    2021-01-05 08:02

    A date format string of @"MMMM" means that the string you're trying to parse is the full name of a month ("January", "October", etc).

    You want something more like:

    yyyy-MM-dd HH:mm:ss
    

    Check out the date formatting patterns for more info.

提交回复
热议问题