-(void)updateString
{
NSString * timeStampString = @"1316641549";
NSTimeInterval _interval=[timeStampString doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
NSLog(@"%@", date);
[webView reload:0];
[self.textField setStringValue:@"hi",date];
}
有人能快点告诉我,我做错了什么吗?我试图将我的文本字段设置为等于我的日期,但[self.textField setStringValue:@"hi",date];
返回“参数太多”格式化需要什么? textField是一个NSTextField。谢谢!
答案 0 :(得分:1)
NSString *dateString = [NSDateFormatter localizedStringFromDate:date
dateStyle:NSDateFormatterShortStyle
timeStyle:NSDateFormatterFullStyle];
[self.textField setStringValue:[NSString stringWithFormat:@"hi %@", dateString]];
答案 1 :(得分:0)
NSString *Datestr = [NSDateFormatter localizedStringFromDate:[NSDate date] dateStyle:NSDateFormatterLongStyle timeStyle:NSDateFormatterMediumStyle];