【问题标题】:strtotime -> NSDatestrtotime -> NSDate
【发布时间】:2010-06-21 19:29:45
【问题描述】:

有没有办法用 NSDate 转换类似strtotime 的字符串(例如:给定日期的“-3 天”)?

【问题讨论】:

    标签: cocoa nsdate foundation


    【解决方案1】:

    请参阅 NSDate 的 +dateWithNaturalLanguageString:。我不确定支持多少“自然语言”(例如您给出的“-3 天”示例),但这是您最好的选择。

    【讨论】:

    • 不幸的是,这没有帮助。看起来我需要自己实现正确的日期时间计算。无论如何谢谢=)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-27
    • 2012-12-06
    • 2012-12-02
    • 2014-12-25
    相关资源
    最近更新 更多