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 {
    static Date createDate(int _Year, int _Month, int _Day) {
        String date = String.valueOf(_Year) + "-" + String.valueOf(_Month) + "-" + String.valueOf(_Day);
        return toDate(date);
    }

    static Date toDate(String _Input) {
        try {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            return dateFormat.parse(_Input);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}