Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {

    public static void main(String[] args) {

        String str_date = "2015-05-15 05:55:55.0";
        DateFormat formatter;
        Date date;
        try {
            formatter = new SimpleDateFormat("yyyy-MM-d HH:mm:ss");
            date = formatter.parse(str_date);
            System.out.println(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }
}