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 {
    /**
     * Wrapper for SimpleDateFormat("yyyy-MM-dd HH:mm:ss").
     * ie. "2014-05-31 19:59:08"
     *
     * @param str "yyyy-MM-dd HH:mm:ss"
     * @return
     * @throws ParseException
     */
    public static Date str2date(String str) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.parse(str);
    }
}