How to determine if an NSDate is today?

前端 未结 20 2015
礼貌的吻别
礼貌的吻别 2020-11-28 18:20

How to check if an NSDate belongs to today?

I used to check it using first 10 characters from [aDate description]. [[aDate descriptio

20条回答
  •  抹茶落季
    2020-11-28 18:58

    This is an offshoot to your question, but if you want to print an NSDate with "Today" or "Yesterday", use the function

    - (void)setDoesRelativeDateFormatting:(BOOL)b
    

    for NSDateFormatter

提交回复
热议问题