Java String to DateWe can convert String to Date in java using parse() method of DateFormat and SimpleDateFormat classes. To learn this concept well, you should visit DateFormat and SimpleDateFormat classes. Java String to Date ExampleLet's see the simple code to convert String to Date in java. Test it NowOutput: 31/12/1998 Thu Dec 31 00:00:00 IST 1998 Let's see another code to convert different types of Strings to Date in java. Here, we have used different date formats using SimpleDateFormat class. Test it NowOutput: 31/12/1998 Thu Dec 31 00:00:00 IST 1998 31-Dec-1998 Thu Dec 31 00:00:00 IST 1998 12 31, 1998 Thu Dec 31 00:00:00 IST 1998 Thu, Dec 31 1998 Thu Dec 31 00:00:00 IST 1998 Thu, Dec 31 1998 23:37:50 Thu Dec 31 23:37:50 IST 1998 31-Dec-1998 23:37:50 Thu Dec 31 23:37:50 IST 1998 Next TopicJava Date to String |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India