format a NSDate to DDMMYYYY?

前端 未结 7 491
面向向阳花
面向向阳花 2021-01-13 18:12

I have to send a DDMMYYY date from a Date to communicate with an API.

NSDateComponents *dateComponents; NSCalendar *gregorian; NSDate *date;

gregoria         


        
相关标签:
7条回答
  • 2021-01-13 18:36
        NSDate *date=[NSDate date];
        NSDateFormatter *formatter=[[NSDateFormatter alloc]init];
        [formatter setDateFormat:@"ddMMyyyy"];
        NSString *dateOfGame =[formatter stringFromDate:date];
        [formatter release];
    
    0 讨论(0)
提交回复
热议问题