Converting NSString to NSDate - wrong format

后端 未结 1 668
粉色の甜心
粉色の甜心 2021-01-16 08:42

Hi I am trying to convert a string into NSDate format - but it returns value with wrong format and also in GMT time.

 NSString *myString = @\"10:30 AM\";
 N         


        
相关标签:
1条回答
  • 2021-01-16 08:55

    Don't use NSLog() to display the date as that will format it using the UTC/GMT timezone and its own format; instead use the date formatter to display it:

    NSLog(@"myDate---%@", [dateFormatter stringFromDate:myDate]);
    
    0 讨论(0)
提交回复
热议问题