How to convert String to Date Time format in Java

Tutorials Shared by the Internet Community

Advertisements


Synopsis

How to convert String to Date Time format in Java

Statistics

  • Total Hits - 5666

  • Total Votes - 6 votes

  • Vote Up - 3 votes

  • Vote Down - 3 votes

  • Domain - www.javatutorialcorner.com

  • Category - JAVA/Core JAVA

  • Submitted By - Appu T

  • Submitted on - 2014-03-16 09:28:51

Description

In this tutorial we are going to see how to convert String to Date Time format using SimpleDateFormat. 1. 12-10-2013 12:02:35 PM format to Util Date Timepackage com.javatutorialscorner.util;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Date;public class StringToDateConvertion { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub SimpleDateFormat dateFormat = null; String inputDate = "12-10-2013 12:02:35 PM"; try { dateFormat = new SimpleDateFormat("dd-MM-yyyy... - See more at: http://www.javatutorialcorner.com/search/label/Java?updated-max=2013-11-09T21:27:00-08:00&max-results=20&start=20&by-date=false ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements