Java Convert Date to String format

Hey guys in this short article, you will learn how to convert the current date and time to String format in Java.

Read More:

To convert Date to String format, we can call toString() method on the Date() object



The following example demonstrates converting the current date and time to String format.

public class ConvertDateToString {
	public static void main(String[] args) {
		//Get the current date and time
		Date currentDateAndTime = new Date();
		//Convert the date and time to string using toString()


Mon Jan 03 15:57:51 IST 2022

That’s it for this post, if you like this post, share this with your friends and colleagues or you can share this within your social media platform. Thanks, I will see you in our next post.

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

Leave a Reply