Java Date Create date(int year, int month, int day)

Here you can find the source of date(int year, int month, int day)

Description

date

License

Open Source License

Declaration

public static Date date(int year, int month, int day) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static Date date(int year, int month, int day) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(year, month - 1, day, 0, 0, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }/* ww w  .ja v a  2 s  .  c  o m*/

    public static Date date(int year, int month, int day, int hour, int minute, int second) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(year, month - 1, day, hour, minute, second);
        calendar.set(Calendar.MILLISECOND, 0);
        return calendar.getTime();
    }
}

Related

  1. date(final int year, final int month, final int dayOfMonth)
  2. date(int day, int month, int year)
  3. date(int y, int m, int d)
  4. date(int year, int month, int date)
  5. date(int year, int month, int day)
  6. date(int year, int month, int day)
  7. date(int year, int month, int day)
  8. date(int year, int month, int day, int hour, int minute)
  9. date(int year, int month, int day, int hour, int minute, int second)