NSDateFormatter return incorrect date from string

前端 未结 3 452
陌清茗
陌清茗 2020-11-30 13:14

I have a method,

+ (NSDate *) convertToDateFrom:(NSString *) dateString
{
    if (dateString == nil || [dateString isEqual:@\"\"]) return nil; //return nil i         


        
3条回答
  •  伪装坚强ぢ
    2020-11-30 13:31

    Try setting the time zone and locale.

    [df setLocale:[NSLocale currentLocale]];
    [df setTimeZone:[NSTimeZone systemTimeZone]];
    

提交回复
热议问题