Class TimeDate


  • public class TimeDate
    extends Object
    Immutable time and date.
    • Constructor Detail

      • TimeDate

        public TimeDate()
        Create time and date with current time.
      • TimeDate

        public TimeDate​(int year,
                        int month,
                        int day,
                        int hour,
                        int minute,
                        int second)
        Create time and date.
      • TimeDate

        public TimeDate​(Calendar calendar)
        Create time and date with current time.
      • TimeDate

        public TimeDate​(String format,
                        String string)
        Create time and date from string.
    • Method Detail

      • getYear

        public int getYear()
        Year since 0.
      • getMonth

        public int getMonth()
        Month since January - [0,11].
      • getDay

        public int getDay()
        Day of the month - [1,31].
      • getHour

        public int getHour()
        Hour since midnight - [0,23].
      • getMinute

        public int getMinute()
        Minute after the hour - [0,59].
      • getSecond

        public int getSecond()
        Second after the minute - [0,59].
      • toCalendar

        public Calendar toCalendar()
        Convert to calendar.
      • format

        public String format​(String format)
        Format date-time as string.
      • toStringRegular

        public String toStringRegular()
        Format as "day-month-year hour:minute:second" string.
      • toStringReceiptDate

        public String toStringReceiptDate()
        Format as "day.mount.year" string for receipts.
      • toStringReceiptTime

        public String toStringReceiptTime()
        Format as "hour:minute:second" string for receipts.
      • toString

        public String toString()
        String representation for debugging purpose.
        Overrides:
        toString in class Object