Java Calendar Month setDate(Calendar cal, int month, int date)

Here you can find the source of setDate(Calendar cal, int month, int date)

Description

set Date

License

LGPL

Declaration

static void setDate(Calendar cal, int month, int date) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    static void setDate(Calendar cal, int month, int date) {

        cal.clear();/*from  w  w w .j  ava2 s  . c  om*/

        cal.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR));
        cal.set(Calendar.MONTH, month);
        cal.set(Calendar.DATE, date);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
    }
}

Related

  1. lastDayOfMonth(Calendar c)
  2. month(Calendar calendar)
  3. month(Calendar date)
  4. numberOfDaysInMonth(Calendar cal)
  5. sameMonth(Calendar one, Calendar two)
  6. setDate(Calendar cal, int month, int date, boolean endOfDay)
  7. setDate(Calendar calendar, int month, int date)
  8. setTimeAsFirstDayOfMonth(Calendar calendar)
  9. subtractMonths(Calendar date, int months)