I would like to know as well.
I have an app that loads RSS feeds and the published dates are formated like that. In my case I just needed to check if the date is for the current year. I ended up just checking the string to see if it contains 2009.
I would like to know as well.
I have an app that loads RSS feeds and the published dates are formated like that. In my case I just needed to check if the date is for the current year. I ended up just checking the string to see if it contains 2009.
Could you please explain how to check whether a string is available in a set of text???
Be careful: I used that on an app, and got a warning. Ignored it just to find out it is not documented and Apple rejected my app for that :-(
I believe you are mistaken. That method is not undocumented. Go check the NSDateFormatter class yourself.
Quote:
dateFromString:
Returns a date representation of a given string interpreted using the receiver’s current settings.
- (NSDate *)dateFromStringNSString *)string
Parameters
string
The string to parse.
Return Value
A date representation of string interpreted using the receiver’s current settings.
Availability
Available in iPhone OS 2.0 and later.
See Also
– getObjectValue:forString:range:error:
– stringFromDate:
Related Sample Code
SeismicXML
URLCache
Declared In
NSDateFormatter.h
Me too have the same problem. I have used the code that is given by Mr.BSDimwit. This is converting the the date from NSString to NSDate. But, there the time is changed. Here i have show the code that is i tried,
My NSLog output is:
DateString : 2011-09-13 11:51:11 +0530 (This is correct date and time from 'stringFromDate')
My Date : 2011-09-13 06:21:11 +0000(After converting NSString from NSDate it shows the wrong time).
I want the result in NSDate format with time, how to omit +0000 digits from the date? Thanks for reading my poor english.
How to solve this problem? Can any one help me please?
Thanks for spending your valuable time with me.
Thanks in advance.