Is there a way to convert a natural language date NSString to an NSDate

后端 未结 1 545
悲&欢浪女
悲&欢浪女 2021-01-17 22:40

Say I have the NSString @\"tomorrow\"

Is there any library that takes strings such as this and converts them into NSDates? I\'m imagining/hoping for som

相关标签:
1条回答
  • 2021-01-17 23:31

    Do you mean something like dateWithNaturalLanguageString:?

    From the link:

    dateWithNaturalLanguageString:

    Creates and returns an NSDate object set to the date and time specified by a given string.

    + (id)dateWithNaturalLanguageString:(NSString *)string

    A string that contains a colloquial specification of a date, such as “last Tuesday at dinner,” “3pm December 31, 2001,” “12/31/01,” or “31/12/01.”

    0 讨论(0)
提交回复
热议问题