-1
-(void)updateString

    {
        NSString * timeStampString = @"1316641549";
        NSTimeInterval _interval=[timeStampString doubleValue];
        NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
        NSLog(@"%@", date);

        [webView reload:0];
        [self.textField setStringValue:@"hi",date];
    }

Can someone quickly tell me what im doing wrong? I am trying to set my text field equal to my date but the [self.textField setStringValue:@"hi",date]; is returning "Too many arguments" What does the formattting need to be? textField is a NSTextField. Thanks!

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Grant Wilkinson
  • 1,088
  • 1
  • 13
  • 38
  • 2
    `setStringValue:` expects a single argument, a string. `@"hi",date` is not just a string, it's a string and a date. – dreamlax Jun 27 '13 at 03:04

2 Answers2

1
NSString *dateString = [NSDateFormatter localizedStringFromDate:date 
                                                      dateStyle:NSDateFormatterShortStyle 
                                                      timeStyle:NSDateFormatterFullStyle];

[self.textField setStringValue:[NSString stringWithFormat:@"hi %@", dateString]];
Danilo
  • 3,257
  • 2
  • 19
  • 24
0
NSString *Datestr = [NSDateFormatter localizedStringFromDate:[NSDate date] dateStyle:NSDateFormatterLongStyle timeStyle:NSDateFormatterMediumStyle];
Bhavesh Nayi
  • 3,626
  • 1
  • 27
  • 42