类 DateUtil
- java.lang.Object
-
- cn.vorbote.commons.DateUtil
-
public final class DateUtil extends Object
DateUtil can transfer unix/java timestamps to Date object.- 作者:
- TheodoreHills
-
-
字段概要
字段 修饰符和类型 字段 说明 static StringJAVA_TIMESTAMPstatic StringUNIX_TIMESTAMP
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static StringDateToString(Date date, String pattern)Transfer Date to Stringstatic CalendarGetCalendar(Date date)Get the calendar instance by a date instance.static DateGetDate(int year, int month, int date)Create a date instance bycalendar.static DateGetDate(Calendar calendar)Create a date instance bycalendar.static DateTimestampToDate(String strDate)Transfer timestamp to class java.util.Date
-
-
-
方法详细资料
-
TimestampToDate
public static Date TimestampToDate(String strDate)
Transfer timestamp to class java.util.Date- 参数:
strDate- timestamp- 返回:
- The Date object if succeed, current date if failed
-
DateToString
public static String DateToString(Date date, String pattern)
Transfer Date to String- 参数:
date- Date objectpattern- The pattern of the string- 返回:
- Converted String
-
GetDate
public static Date GetDate(int year, int month, int date)
Create a date instance bycalendar.- 参数:
year- The year num such as 2021.month- The month num such asCalendar.JANUARYdate- The date in that month.- 返回:
- The date instance created by the specified date.
-
GetDate
public static Date GetDate(Calendar calendar)
Create a date instance bycalendar.- 参数:
calendar- The calendar instance.- 返回:
- The date instance created by the specified date.
-
-