Android Gregorian Date Create 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

License

Apache License

Declaration

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

Method Source Code

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

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);//w  w w.j a v  a  2  s .c  om
        return c.getTime();
    }

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

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

Related

  1. isGregorianDate(int year, int month, double day)
  2. isValid(int year, int month, int day)
  3. getCalendar()
  4. dateInts2String(int year, int month, int day)