zoukankan      html  css  js  c++  java
  • 在日期选择轮中选择的时间转换成年龄

    if (sender.tag == TAG_BUTTON_SUMMIT) {
            NSTimeInterval dateDiff = [[dataPicker date] timeIntervalSinceNow];
            int age= fabs(trunc(dateDiff / (60 * 60 * 24)) / 365);
            ageLabel.text = [NSString stringWithFormat:@"%d", age];
            NSDate *date = [dataPicker date];
            //    限定格式
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"yyyyMMdd"];
            [formatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];
           
            NSString *strDate = [formatter stringFromDate:date];
            NSLog(@"$$$$$$$$$$$$$$$$$$$$$$$$$$$%@", strDate);
           
            [_userDic setObject:strDate forKey:USERAGE];
            NSDictionary *user = [NSDictionary dictionaryWithDictionary:_userDic];
            [_dataHandle saveLocalData:USERINFO value:user];
        }
  • 相关阅读:
    乱码问题
    play之路由 routes
    delphi之http通讯
    delphi之socket通讯
    Delphi之ComboBox
    delphi 常用函数
    字节
    EXCEPT
    V_REPORT_AOC_FUEL]
    相同表结构不同记录
  • 原文地址:https://www.cnblogs.com/tian-sun/p/4849763.html
Copyright © 2011-2022 走看看