How to extract Day, Month and Year values from a string [like 18/08/2012]. I tried using SimpleDateFormat, but it returns a Date object and I observed that all the Get methods are deprecated. Is there any better way to do this?
Thanks
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.
Personally I’d use Joda Time, which makes life considerably simpler. In particular, it means you don’t need to worry about the time zone of the
Calendarvs the time zone of aSimpleDateFormat– you can just parse to aLocalDate, which is what the data really shows you. It also means you don’t need to worry about months being 0-based 🙂Joda Time makes many date/time operations much more pleasant.