Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

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

    public static Date parse(String fullDate, Locale locale) throws ParseException {
        DateFormat format = new SimpleDateFormat(IN_FORMAT, locale);

        return format.parse(fullDate);
    }

    public static Date parse(String fullDate) throws ParseException {
        return parse(fullDate, Locale.getDefault());
    }
}