Here you can find the source of CreateDate(long milliseconds)
Parameter | Description |
---|---|
milliseconds | Time in milliseconds. |
public static Date CreateDate(long milliseconds)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.*; public class Main { /** Convenience method for creating a date object. */*from ww w .j ava 2 s .c o m*/ * @param year Year * @param month Month * @param day Day * @return Date object */ public static Date CreateDate(int year, int month, int day) { return CreateDate(year, month, year, 0, 0, 0); } /** Convenience method for creating a date object. * * @param year Year * @param month Month * @param day Day * @param hour Hour * @param minute Minute * @param second Second * @return Date object */ public static Date CreateDate(int year, int month, int day, int hour, int minute, int second) { Calendar cal = Calendar.getInstance(); cal.set(year, month, day, hour, minute, second); return cal.getTime(); } /** Convenience method for creating a date object. * * @param milliseconds Time in milliseconds. * @return Date object */ public static Date CreateDate(long milliseconds) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(milliseconds); return cal.getTime(); } }