iOS-获取今天24点

- (NSDate*)zeroOfDate

{


    NSDate*date = [NSDatedate];

    NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];

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

    [gregoriansetTimeZone:gmt];

    NSDateComponents*components = [gregoriancomponents:NSUIntegerMaxfromDate: date];

    [componentssetHour:24];

    [componentssetMinute:0];

    [componentssetSecond: -1];

    NSDate*newDate = [gregoriandateFromComponents: components];

    NSLog(@"Date%@", newDate);


    returnnewDate;

}

你可能感兴趣的:(iOS-获取今天24点)