标签:ios objective-c ios开发
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)onclick:(id)sender { NSDate *theDate = self.dataPicker.date; // descriptionWithLocale 方法返回本地时间 // currentLocale 返回当前使用者信息 NSLog(@"the date picked is: %@", [theDate descriptionWithLocale:[NSLocale currentLocale]]); // 设定格式化格式 // dd和DD的区别 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // 输出 NSLog(@"the date formate is: %@",[dateFormatter stringFromDate:theDate]); self.label.text = [dateFormatter stringFromDate:theDate]; }
标签:ios objective-c ios开发
原文地址:http://blog.csdn.net/liyakun1990/article/details/40383917