NSDateFormatter not working properly?

后端 未结 2 1753
误落风尘
误落风尘 2021-01-28 05:02

My code ,

-(NSString *)trimDateStringInRequiredFormat:(NSString *)dateInString{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFor         


        
2条回答
  •  旧巷少年郎
    2021-01-28 05:37

    try doing:

    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    

    With hh you have the 12h format, with HH you use 24h format

提交回复
热议问题