Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static Date getSqlDate(int day, int month, int year) {
        java.sql.Date sqlDate = null;
        try {
            java.util.Date utilDate = new SimpleDateFormat("dd/M/yyyy").parse(day + "/" + month + "/" + year);
            sqlDate = new java.sql.Date(utilDate.getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return sqlDate;
    }
}