【发布时间】:2017-05-10 21:01:05
【问题描述】:
我有一个包含默认 Date() 的字符串,如下所示:
"2017-05-10 20:34:18 +0000"
如果本月的数字与字符串相同,如何运行函数? (在这种情况下,月份应该是5)
我认为它可能看起来像这样:
let CurrentMonth = 5 // This number should be the number of the current month
let StringsMonth = 5 // This number should be grabbed from the string shown above.
if StringsMonth == CurrentMonth {
print("WORKS!")
}
谢谢!
【问题讨论】:
标签: ios swift string date formatting