xcode
I want convert from string to date
NSDate *LastBuildDate; NSDate *PubDate; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:#"yyyyMMddhhmmss"]; LastBuildDate = [formatter dateFromString:buttoninfoamtion.mLastdate]; PubDate=[formatter dateFromString:newsItem.mPubDate]; if([PubDate compare:LastBuildDate]) buttoninfomation.mlastdate and newsItem.mPubDate is string from OpenAPI ex) buttoninfomation.mlastdate: Tue, 18 Oct 2011 15:54:43 +0900 newspub:Tue, 18 Oct 2011 15:58:00 +0900 but LastBuidDate = (null) PubDate = (null) I want to compare two factor . So date- date or string- string but I think string - string is so complex. what wrong up codes?
Well the format you've given of "yyyyMMddhhmmss" doesn't match "Tue, 18 Oct 2011 15:54:43 +0900" even slightly. Try EEE, dd MMM yyyy HH:mm:ss Z as the format string - see the iOS documentation and the Unix TR#35 for more information.
Related Links
Xcode 8 upgrade errors
Is it possible to view source code WITHOUT rendering markdown in a .xcplaygroundpage?
xcode change output of console information [duplicate]
productbuild - Resources not copying
Copy the complete content of general NSPasteboard
XCode XCAssets and autocompletion
Xcode Folder references > missing files
How do you auto build custom included frameworks or “kits” in Xcode?
resubmitting to App Store, should I increase version number or build in xcode?
Code Signature Invalid
I can no longer comment code using Xcode 8.0
Stack guard causing crash C++ Memory allocation of Vector
How to find object by debug - address in xcode
Unable to boot simulator xcode 7.3.1 / OS 10.11.6
xcodebuild pass arguments to application on iOS
iMessage sticker app size export in xcode