关于日期的一些操作

2019-07-31  本文已影响0人  CaptainRoy
-(NSString *)currentDate
{
    NSDateFormatter *format = [[NSDateFormatter alloc]init];
    NSDate *date = [NSDate date];
    [format setDateFormat:@"yyyy-MM-dd"];
    return [format stringFromDate:date];
}
-(BOOL)isToday:(NSString *)dateStr
{
    NSDateFormatter *format = [[NSDateFormatter alloc]init];
    [format setDateFormat:@"yyyy-MM-dd"];
    NSDate *date = [format dateFromString:dateStr];
    return [[NSCalendar currentCalendar] isDateInToday:date];
}
上一篇下一篇

猜你喜欢

热点阅读