【发布时间】:2016-10-10 13:27:49
【问题描述】:
我正在尝试将此日期“2016 年 6 月 18 日。星期六”解析为“18/06/2016” 我知道这可以使用正则表达式方法来完成,但我不确定你如何使用它获得输出。
在 swift 中使用 NSDateFormatter 的方法是首选
【问题讨论】:
-
使用
NSDateFormatter是正确的解决方案。使用正则表达式根本不是你应该这样做的。用你迄今为止尝试过的方法更新你的问题。 -
也许阅读文档。
-
NSDateFormatter的 Apple 文档:developer.apple.com/library/mac/documentation/Cocoa/Reference/…。如果您对NSDateFormatter有特定问题,请编辑您的问题以包含代码和您遇到的问题。
标签: ios regex swift date nsdateformatter