Monday, 3 October 2016

java - How to convert String into Date in this format yyyy-MM-dd ?

I am working on dateFormat in java,I am facing some problem,Please check my code below



String sDate = "2014-05-20";

Date convertDate = new Date(s);
System.out.println(convertDate );


It's working fine but the output is like



OutPut:Tue May 20 13:52:40 IST 2014


but I dont' won't the output like this ,I want out put same as String format




ExpectedOutput :2014-05-20


how can i do this any one help me

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...