I am getting the date (which is varchar in database) from database. I want to use this String as a date. the String format is “yyyy-mm-dd”. How will it be converted to actual date type?
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.
Two suggested options:
SimpleDateFormatif you’re happy using the JDK classes.DateTimeFormatterif you’re doing a lot of date/time work and thus want to use Joda Time.Personally I’m a big fan of Joda Time (and not a big fan of the JDK classes) but as you’re running on Android, you may not like the size of Joda Time. (You could build your own cut-down version, admittedly.)