/**

 * @method

 *

 * @brief 获取两个日期之间的天数

 * @param fromDate       起始日期

 * @param toDate         终止日期

 * @return    总天数

 */

+ (NSInteger)numberOfDaysWithFromDate:(NSDate *)fromDate toDate:(NSDate *)toDate{

    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];

    

    NSDateComponents    * comp = [calendar components:NSCalendarUnitDay

                                             fromDate:fromDate

                                               toDate:toDate

                                              options:NSCalendarWrapComponents];

    return comp.day;

}

相关文章:

  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2021-08-30
  • 2021-06-26
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案