I want to format my NSDate
so that a date that occurred yesterday will be displayed as "Yesterday'. Can this be done using NSDateFormatter
?
Use,
[dateFormatter setDoesRelativeDateFormatting:YES]
to indicate if an output of date components need to be printed in a phrase or not, as "Today", "Tomorrow" etc.
The output phrases however, depend on the locale
set for the dateFormatter
Read through the Managing Natural Language Support of the NSDateFormatter Class Reference for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With