Tuesday 24 December 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...