Android Date String to Date Convert getDateObj(String argsDate, String split)

Here you can find the source of getDateObj(String argsDate, String split)

Description

get Date Obj

License

Apache License

Declaration

public static Date getDateObj(String argsDate, String split) 

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);//from w  w  w.j  a  v  a2 s  . co  m
        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. toDateFromLongFormat(String date)
  2. parse(String aFormat, String date)
  3. getDate(String date)
  4. getDateFromString(String dateStr, String pattern)
  5. getDateFromString(String string)
  6. getDateOffset(String date, int offset)
  7. getDateTomorrow(String date)
  8. convertStandardDateTime(String time)
  9. removeTimeZone(String data)