Reputation: 766
I'm getting a bunch of information from a web server with SOAP and NSXMLParser, and one of the properties I'm getting is time for when a kid is being picked up...
e.g. a response would be: PT15H
In the documentation it's called: System.TimeSpan pickUpTime
Now, the other properties includes stuff like integers, strings and booleans and I just save them with e.g.
else if([elementName isEqualToString:@"a:LastName"])
{
aParent.lastName = currentElementValue;
}
What do I do with PickUpTime? I need to get the time and show it in a label in a clean manner, like 15:00
Upvotes: 0
Views: 652
Reputation: 766
Decided to just use stringByReplacingOccurrencesOfString to remove the letters, since I know that I will always get certain letters... then I can convert it into a NSDate with with the format HH:mm
Upvotes: 0
Reputation: 14304
You can use NSDateFormatter and give it the proper structure of the strings you are getting. This way it can be converted into an NSDate object for your use, i.e. displaying it as "15:00" and such.
Upvotes: 1