Java Date Create createDate(int month, int day)

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

Description

create Date

License

Open Source License

Declaration

public static Date createDate(int month, int day) 

Method Source Code

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

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

public class Main {
    public static Date createDate(int year, int month, int day, int hour, int minute, int second) {
        Calendar c = Calendar.getInstance();
        c.set(year, month - 1, day, hour, minute, second);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }//from  ww w  .  j  av  a 2s  . c o  m

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

    public static Date createDate(int year, int month, int day) {
        Calendar c = Calendar.getInstance();
        c.set(year, month - 1, day, 0, 0, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }

    public static Date createDate(int month, int day) {
        Calendar c = Calendar.getInstance();
        c.set(c.get(Calendar.YEAR), month - 1, day, 0, 0, 0);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }
}

Related

  1. createDate(final int aYear, final int aMonth, final int aDate, final int aHour, final int aMinute, final int aSecond)
  2. createDate(final int day, final int month, final int year)
  3. createDate(final int month, final int day, final int year)
  4. createDate(final int year, final int month, final int day, final int hour, final int minute, final int second, final int millisecond)
  5. createDate(final int yyyy, final int month, final int day)
  6. createDate(int year, int month, int date)
  7. createDate(int year, int month, int date)
  8. createDate(int year, int month, int date)
  9. createDate(int year, int month, int date)