码迷,mamicode.com
首页 > 其他好文 > 详细

年,月,日,时,分,秒

时间:2014-10-30 13:36:21      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   sp   div   on   2014   log   

NSDate *now = [NSDate date];
NSCalendar *cal = [NSCalendar currentCalendar];
unsigned int unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit | NSWeekdayCalendarUnit;
NSDateComponents *dd = [cal components:unitFlags fromDate:now]; 
int y = [dd year];
int m = [dd month];
int d = [dd day];
int week = [dd weekday];
int hour = [dd hour];
int minute = [dd minute];
int second = [dd second];


年,月,日,时,分,秒

标签:style   blog   color   ar   sp   div   on   2014   log   

原文地址:http://blog.csdn.net/huang2009303513/article/details/40617641

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!