+ (NSString*)weekdayStringFromDate:(NSDate*)inputDate {
NSArray*weekdays = [NSArrayarrayWithObjects: [NSNullnull],@"星期日",@"星期一",@"星期二",@"星期三",@"星期四",@"星期五",@"星期六",nil];
NSCalendar*calendar = [[NSCalendaralloc]initWithCalendarIdentifier:NSGregorianCalendar];
NSTimeZone*timeZone = [[NSTimeZonealloc]initWithName:@"Asia/Shanghai"];
[calendarsetTimeZone: timeZone];
NSCalendarUnitcalendarUnit =NSWeekdayCalendarUnit;
NSDateComponents*theComponents = [calendarcomponents:calendarUnitfromDate:inputDate];
return[weekdaysobjectAtIndex:theComponents.weekday];
}
网友评论