程序包 cn.vorbote.time

类 DateTime

    • 构造器详细资料

      • DateTime

        public DateTime()
        Generate a new DateTime instance of current time.
      • DateTime

        public DateTime​(int year,
                        int month,
                        int date)
        Generate a specified DateTime instance of the date.
        参数:
        year - The year (1 through 9999).
        month - The month (1 through 12).
        date - The day (1 through the number of days in month).
      • DateTime

        public DateTime​(int year,
                        int month,
                        int date,
                        int hour,
                        int minute,
                        int second)
        Generate a specified DateTime instance of the date.
        参数:
        year - The year (1 through 9999).
        month - The month (1 through 12).
        date - The day (1 through the number of days in month).
        hour - The hour (0 through 23).
        minute - The minute (0 through 59).
        second - The second (0 through 59).
      • DateTime

        public DateTime​(int year,
                        int month,
                        int date,
                        int hour,
                        int minute,
                        int second,
                        int mills)
        Generate a specified DateTime instance of the date.
        参数:
        year - The year (1 through 9999).
        month - The month (1 through 12).
        date - The day (1 through the number of days in month).
        hour - The hour (0 through 23).
        minute - The minute (0 through 59).
        second - The second (0 through 59).
        mills - The mills (0 through 999).
    • 方法详细资料

      • Unix

        public long Unix()
        Get the Unix Timestamp of this current time.
        返回:
        The Unix Timestamp of this DateTime instance.
      • Add

        public DateTime Add​(TimeSpan ts)
        Add the specific time to the DateTime instance.
        参数:
        ts - Time Span.
        返回:
        The time after added this TimeSpan.
      • Minus

        public DateTime Minus​(TimeSpan ts)
        Minus the specific time to the DateTime instance.
        参数:
        ts - Time Span.
        返回:
        The time after added this TimeSpan.
      • Pattern

        public void Pattern​(String pattern)
        Set pattern for this datetime.
        参数:
        pattern - The formatted String.
      • Pattern

        public String Pattern()
        Get pattern for this datetime.
        返回:
        The pattern String.
      • Timestamp

        public void Timestamp​(long timestamp)
        Set the timestamp.
        参数:
        timestamp - The timestamp.
      • Timestamp

        public long Timestamp()
        Get the timestamp.
        返回:
        The timestamp.
      • ToString

        public String ToString()
      • compareTo

        public int compareTo​(DateTime o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        指定者:
        compareTo 在接口中 Comparable<DateTime>
        参数:
        o - the object to be compared.
        返回:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        抛出:
        NullPointerException - if the specified object is null
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • CompareTo

        public int CompareTo​(DateTime o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        参数:
        o - the object to be compared.
        返回:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        抛出:
        NullPointerException - if the specified object is null
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • Now

        public static DateTime Now()
        Get the current Date and Time.
        返回:
        The current Date and Time.