2 Answers

  1. Jackson- Reply

    2019-11-15

    I'm operating on an assumption that title.timestamp is instance of NSDate. You can use description method:

    cell.lblHistoryTimeStamp.text = [title.timestamp description];
    

    But it will output ugly format. So you'd have to use NSDateFormatter:

    NSDateFormatter * df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyy-M-d"];
    cell.lblHistoryTimeStamp.text = [df stringFromDate:title.timestamp];
    
  2. Jacob- Reply

    2019-11-15

    You will need to use NSDateFormatter to convert NSDate to NSString (assuming your timestamp is an NSDate instance):

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSString *dateString = [dateFormatter stringFromDate:timestamp];
    

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>