i have a NSString variables like this
dd-MM-YYYY exemple 30-05-2011 . How can i get day in a variable , month in variable and year in variable ?
thank you
i have a NSString variables like this dd-MM-YYYY exemple 30-05-2011 . How can i
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
NSDateFormatterandNSDateComponents.In particular, for the format “dd-MM-YYYY”:
Now you’re free to access
[comps day],[comps month], and[comps year].See here for a description of all the format-parsing options. Keep in mind that NSDateFormatter also supports older versions of this standard, so you’ll have to be careful.