Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

    public static Date getDateByCalendar(String year, String month, String day) {
        Date date = null;
        try {
            date = format.parse(
                    new StringBuffer().append(year).append("-").append(month).append("-").append(day).toString());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
}