Android Date Get getDate(int year, int month, int date, int hourOfDay, int minute, int second)

Here you can find the source of getDate(int year, int month, int date, int hourOfDay, int minute, int second)

Description

get Date

License

Apache License

Declaration

public static Date getDate(int year, int month, int date,
        int hourOfDay, int minute, int second) 

Method Source Code

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

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date getDate(String sDate, String dateFormat) {
        SimpleDateFormat fmt = new SimpleDateFormat(dateFormat);
        ParsePosition pos = new ParsePosition(0);

        return fmt.parse(sDate, pos);
    }//from  w w  w . j  a  v  a  2  s .  c  o  m

    public static Date getDate(int year, int month, int date,
            int hourOfDay, int minute, int second) {
        Calendar cal = new GregorianCalendar();
        cal.set(year, month, date, hourOfDay, minute, second);
        return cal.getTime();
    }
}

Related

  1. getMonth(Date date)
  2. getTomorrowAtEight()
  3. getWeekOfDate(Date dt)
  4. getYear(Date date)
  5. getDateObj()
  6. getCurrentDateYearMonthDateHourMinuteSecond()
  7. createDate(final int month, final int day, final int year)
  8. getDate(int year, int month)
  9. getDateFromString(String dateString)