• 在日期选择轮中选择的时间转换成年龄


    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];
        }
  • 相关阅读:
    Evaluation
    Version
    bzoj4184-shallot
    jQuery 获取并设置 CSS 类
    jQuery 删除元素
    jQuery 添加元素
    jQuery 设置内容和属性
    jQuery
    jQuery Chaining
    CI 框架增加公用函数-如何使用Helper辅助函数
  • 原文地址:https://www.cnblogs.com/tian-sun/p/5019968.html
Copyright © 2020-2023  润新知