Getting human readable relative times and dates from a unix timestamp?

前端 未结 6 499
挽巷
挽巷 2021-01-14 00:32

Starting with a unix timestamp like 1290529723, how would I (assuming gmt) get the information on whether it is:

  • today (if so, what time)

  • i

6条回答
  •  庸人自扰
    2021-01-14 01:17

    The NSDateFormatter class has what you need. It does do "today", "tomorrow" etc. via the doesRelativeDateFormatting method.

    Hope that helps someone else who lands on here and doesn't want to use an external class or creates his own.

提交回复
热议问题