//获取系统当前时间
- (NSString*)get_system_today_time
{
NSDate *date = [NSDate date];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:kCFDateFormatterMediumStyle];
[formatter setTimeStyle:kCFDateFormatterShortStyle];
[formatter setDateFormat:@"YYYY-MM-dd-hh-mm-ss"];
NSString *string_time = [formatterstringFromDate:date];
NSArray *time = [string_timecomponentsSeparatedByString:@"-"];
int value_year = [[timeobjectAtIndex:0]intValue];
int value_month = [[timeobjectAtIndex:1]intValue];
int value_day = [[timeobjectAtIndex:2]intValue];
int value_hour = [[timeobjectAtIndex:3]intValue];
int value_minute = [[timeobjectAtIndex:4]intValue];
int value_second = [[timeobjectAtIndex:5]intValue];
[formatter setDateFormat:@"EEEE"];
NSString *week_day = [formatter stringFromDate:date];
[formatter release];
NSString *system_time = [[NSStringalloc]initWithFormat:@"{\"year\":\"%d\",\"month\":\"%d\",\"day\":\"%d\",\"hour\":\"%d\",\"minute\":\"%d\",\"second\":\"%d\",\"week_day\":\"%@\"}",value_year,value_month,value_day,value_hour,value_minute,value_second,week_day];
NSLog(@"\nsystem time is %@",system_time);
return [system_timeautorelease];
}
----------------------------------------------------------------------------