Java Year Month encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds)

Here you can find the source of encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds)

Description

Return a date.

License

LGPL

Parameter

Parameter Description
year Year
month Month. 1 is January
day Day
hour Hour
minutes Minutes
seconds Seconds

Return

A valid date

Declaration

public static Date encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds) 

Method Source Code

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

import java.util.*;

public class Main {
    /**//from  w  ww  .  ja  v  a 2 s .c  o  m
     * Return a date.
     *
     * @param year    Year
     * @param month   Month. 1 is January
     * @param day     Day
     * @param hour    Hour
     * @param minutes Minutes
     * @param seconds Seconds
     * @return A valid date
     */
    public static Date encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds) {
        Date result;
        Calendar calendar = Calendar.getInstance();
        calendar.set(year, month - 1, day, hour, minutes, seconds);
        result = calendar.getTime();
        return result;
    }
}

Related

  1. createDate(int year, int month, int day)
  2. createDate(int year, int month, int dayOfMonth)
  3. date(final int year, final int month, final int day, final int hour, final int minute, final int second)
  4. date(int year, int month, int day)
  5. Date2Long(int year, int month, int date)
  6. getAddedDate(Date date, int addYear, int addMonth, int addDay, int addHour, int addMinute, int addSecond)
  7. getAllDate(String year_month)
  8. getBeginEndDayOfMonth(String yearMonthString)
  9. getCurrentYearMonthDay()