Date Formatting

Discussion in 'iOS Programming' started by davbeck, Dec 20, 2009.

  1. davbeck macrumors regular

    Joined:
    May 16, 2008
    Location:
    Reno, NV
    #1
    Is there a simple way to format dates like the iPhone SMS app does? That being that if a date is from the same day, show the time and if it's from the past week show the day of the week and if it's older show a date like 1/2/09.

    I don't see anything like this in NSDateFormatter.
     
  2. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #2
    You will have to use the NSDate to get the current date and time and then check if it is the before the current date, if it is you can use the NSDateFormater to get only the date. Else get the time.
     

Share This Page