类 DateUtil


  • public final class DateUtil
    extends Object
    DateUtil can transfer unix/java timestamps to Date object.
    作者:
    TheodoreHills
    • 方法详细资料

      • 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 object
        pattern - The pattern of the string
        返回:
        Converted String
      • GetDate

        public static Date GetDate​(int year,
                                   int month,
                                   int date)
        Create a date instance by calendar.
        参数:
        year - The year num such as 2021.
        month - The month num such as Calendar.JANUARY
        date - The date in that month.
        返回:
        The date instance created by the specified date.
      • GetDate

        public static Date GetDate​(Calendar calendar)
        Create a date instance by calendar.
        参数:
        calendar - The calendar instance.
        返回:
        The date instance created by the specified date.
      • GetCalendar

        public static Calendar GetCalendar​(Date date)
        Get the calendar instance by a date instance.
        参数:
        date - The date instance.
        返回:
        The calendar instance.