I have a date format as “Nov 10,1980″ in a string format(String str=”Nov 10, 1980”), and i want to convert it to 1980-11-10. can any one tell me how to do that using java.
Thanks in advance
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.
You should first parse it from the original text format, then format the result using the format you want it to end up as. You can use
SimpleDateFormatfor this, or Joda Time (which is generally a much better date/time API).Sample code using
SimpleDateFormat:Note that: