How can I use NSDateFormatter to get the string “Yesterday”? [closed]
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I want to format my NSDate so that a date that occurred yesterday will be displayed as "Yesterday'. Can this be done using NSDateFormatter ? 回答1: Use, [dateFormatter setDoesRelativeDateFormatting:YES] to indicate