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];
获取年月日时分秒
时间: 2024-10-25 06:30:46