Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    private static final String FORMAT_TYPE = "yyyy-MM-dd HH:mm:ss";

    public static Date stringToDate(String strTime) throws ParseException {
        SimpleDateFormat formatter = new SimpleDateFormat(FORMAT_TYPE);
        Date date = null;
        date = formatter.parse(strTime);
        return date;
    }
}