NSDate
*now = [
NSDate
date];
NSCalendar
*cal = [
NSCalendar
currentCalendar];
unsigned
int
unitFlags =
NSWeekdayCalendarUnit
|
NSHourCalendarUnit
|
NSMinuteCalendarUnit
|
NSSecondCalendarUnit
;
NSDateComponents
*dd = [cal components:unitFlags fromDate:now];
NSInteger
week = [dd weekday];
NSInteger hour = [dd hour];
NSInteger minute = [dd minute];
NSInteger
second = [dd second];
原文:http://www.cnblogs.com/huangjl/p/3907016.html