The specific methods are as follows:

// 2019-02-21 17:30:45 1550741445 /* / NSString *timeInterval = [NSString stringWithFormat:@"%ld", (long)[[NSDate date] timeIntervalSince1970]];
    NSLog(@"Current timestamp: %@ -- Current timestamp to time: %@", timeInterval, YHIntervalToTime(timeInterval));
    NSLog(@"Timestamp conversion time, time format custom: %@", YHDateStringWithTimeInterval(timeInterval, @"Yyy year MM month DD day HH MM minute ss second")); /** dateFormat */ NSString *dateFormat = @"yyyy-MM-dd HH:mm:ss"; /** currentTime Str*/ NSString *currentTime = YHGetCurrentTime(dateFormat); NSLog(@"Current time: %@", currentTime); /** currentDate */ NSDate *currentDate = YHDateFromString(currentTime, dateFormat); NSLog(@"Str turned the Date: % @", currentDate);
    NSLog(@"Str to Date(custom area): %@", YHDateFromStringAndZone(currentTime, dateFormat, [NSTimeZone timeZoneWithAbbreviation:@"UTC"]));
    NSLog(@"The Date turned Str: % @", YHStringFromDate(currentDate, dateFormat));
    
    NSLog(@"Time/date conversion - current week: %@", YHNumDaysWeeks(currentDate));
    NSLog(@"Time/date conversion - current month: %@", YHNumDaysMonth(currentDate));
    
    NSDate *date = YHDateFromString(@"The 2019-02-21 17:30:45", dateFormat);
    if(! YHComparisonDateTimeIsOneDay(date, currentDate, dateFormat)) { NSLog(@"Two different times.");
        
        NSLog(@"Time difference between specified time and current time: %ld", (long)YHSpecifiesDifferenceBetweenTimeAndCcurrentTime(date));
        NSLog(@"Time difference calculation (same time format): %ld",
              (long)YHComparisonDateTimeDifference(date, currentDate, dateFormat));
    }
Copy the code

The specific encapsulated classes described above are in the YHUtility class on GitHub.


The above is the content of the summary, but also ask great god to give advice!