How to convert date to string format in java?

2.29K viewsJava
0

I want to convert date to string format in java, please advice me.

 

Changed status to publish
Add a Comment
0

Use the below snippet, it will work for your requirements.

 

SimpleDateFormat convertedDateFormat = new SimpleDateFormat(dateformat);//here pass the date format
String stringDate=convertedDateFormat.format(date); //here pass the input date

 

Changed status to publish
Add a Comment
Write your answer.