=======================================
NSDateFormatter *format = [[[NSDateFormatter alloc] init] autorelease];
format.timeStyle = NSDateFormatterNoStyle;
format.dateFormat = @"yyyy/MM/dd";
NSDate *date = [format dateFromString:@"1970/01/01"];
NSDate -> NSString
=======================================
NSDateFormatter *format = [[[NSDateFormatter alloc] init] autorelease];
format.timeStyle = NSDateFormatterNoStyle;
format.dateFormat = @"yyyyMMdd";
__birthField.text = [format stringFromDate:__birthPicker.date];
參考網址:
How can I initialize a date to NSdate?
Objective-C - NSString 和 NSDate 互相轉換
沒有留言:
張貼留言