java tutorial - How to Convert Date to String in Java - java programming - learn java - java basics - java for beginners
Learn Java - Java tutorial - convert date to string - Java examples - Java programs
Convert Date to String in Java
- The format() method of DateFormat class is used to convert Date into String. DateFormat is an abstract class.
- The child class of DateFormat is SimpleDateFormat.
- It is the implementation of DateFormat class.
- The function converts a Date to a String.
- In the below function I have used the format yyyy-MM-dd hh:mm:ss, however if you want the result in any other format then you can simply modify the pattern in SimpleDateFormat.