Java Year Month makeDate(int day, int month, int year, int hour, int min, int sec)

Here you can find the source of makeDate(int day, int month, int year, int hour, int min, int sec)

Description

make Date

License

Open Source License

Declaration

public static Date makeDate(int day, int month, int year, int hour, int min, int sec) throws ParseException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date makeDate(int day, int month, int year, int hour, int min, int sec) throws ParseException {
        DateFormat df1 = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
        String sdate = day + "-" + month + "-" + year + " " + hour + ":" + min + ":" + sec;
        Date date = df1.parse(sdate);
        //      System.out.println(sdate);
        //      System.out.println(date.toString());
        return date;
    }//  w ww  .  j  ava  2s.com

    public static Date makeDate(int[] dayMonthYearHourMinuteSecond) throws ParseException {
        return makeDate(dayMonthYearHourMinuteSecond[0], dayMonthYearHourMinuteSecond[1],
                dayMonthYearHourMinuteSecond[2], dayMonthYearHourMinuteSecond[3], dayMonthYearHourMinuteSecond[4],
                dayMonthYearHourMinuteSecond[5]);
    }
}

Related

  1. getYearMonthList(int year)
  2. getYearMonths(List time)
  3. getYearMonthStr(Date parseDate)
  4. getYearMonthString(Date date)
  5. lastDay(int year, int month)
  6. monthBeginDate(int year, int month)
  7. newDate(int year, int month, int day)
  8. normalizeShortDate(String year, String month, String day)
  9. parseMonthAndYearStringOrNull(String dateString)