Date does not appear in UILabel

前端 未结 2 1610
忘了有多久
忘了有多久 2021-01-24 13:00

What is wrong with this code?

    NSString *strTest = @\"Sun Apr 12 23:29:24 +0000 2009\";
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
          


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-24 13:34

    You are giving MM/dd/yy pattern to dateFormatter but your date string is not fit for that thus dateFormatter returning a nil date.

提交回复
热议问题