标签:ios开发
直接看代码 最直接
//日期处理 NSDate *now = [NSDate date]; NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *comonents = [calendar components:NSYearCalendarUnit|NSMonthCalendarUnit|NSDayCalendarUnit|NSHourCalendarUnit|NSMinuteCalendarUnit fromDate:now]; NSInteger year = [comonents year]; NSInteger month = [comonents month]; NSInteger day = [comonents day]; NSInteger hour = [comonents hour]; NSInteger minute = [comonents minute]; NSInteger date_year_qian = year / 1000; NSInteger date_year_bai = (year % 1000) / 100; NSInteger date_year_shi = (year % 100) / 10; NSInteger date_year_ge = year % 10; NSInteger date_month_shi = month / 10; NSInteger date_month_ge = month % 10; NSInteger date_day_shi = day / 10; NSInteger date_day_ge = day % 10; NSInteger time_hour_shi = hour / 10; NSInteger time_hour_ge = hour % 10; NSInteger time_minute_shi= minute / 10; NSInteger time_minute_ge = minute % 10;
取得日期、时间的各个位置的数字,布布扣,bubuko.com
标签:ios开发
原文地址:http://blog.csdn.net/feixiang_song/article/details/37880953