Android Date Get getDateObj(int year, int month, int day)

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

Description

get Date Obj

Declaration

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

Method Source Code

//package com.java2s;

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

public class Main {
    public static Date getDateObj(int year, int month, int day) {
        Calendar c = new GregorianCalendar();
        c.set(year, month - 1, day);/*from   w  ww  . ja  va  2s  .c om*/
        return c.getTime();
    }

    public static Date getDateObj(String argsDate, String split) {
        String[] temp = argsDate.split(split);
        int year = Integer.valueOf(temp[0]);
        int month = Integer.valueOf(temp[1]);
        int day = Integer.valueOf(temp[2]);
        return getDateObj(year, month, day);
    }

    public static Date getDateObj() {
        Calendar c = new GregorianCalendar();
        return c.getTime();
    }
}

Related

  1. getDate(String sDate, String dateFormat)
  2. getDate(int year, int month, int date, int hourOfDay, int minute, int second)
  3. getDateFromString(String dateStr, String pattern)
  4. getDateObj()
  5. getDateObj(String argsDate, String split)
  6. getDateOffset(String date, int offset)
  7. getDateTomorrow(String date)
  8. getDayOfWeek(Date date)
  9. getDayOfWeek(String date)