Here you can find the source of encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds)
Parameter | Description |
---|---|
year | Year |
month | Month. 1 is January |
day | Day |
hour | Hour |
minutes | Minutes |
seconds | Seconds |
public static Date encodeDateTime(int year, int month, int day, int hour, int minutes, int seconds)
//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; } }