Package com.six.timapi
Class TimeDate
- java.lang.Object
-
- com.six.timapi.TimeDate
-
public class TimeDate extends Object
Immutable time and date.
-
-
Constructor Summary
Constructors Constructor Description TimeDate()
Create time and date with current time.TimeDate(int year, int month, int day, int hour, int minute, int second)
Create time and date.TimeDate(String format, String string)
Create time and date from string.TimeDate(Calendar calendar)
Create time and date with current time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(String format)
Format date-time as string.int
getDay()
Day of the month - [1,31].int
getHour()
Hour since midnight - [0,23].int
getMinute()
Minute after the hour - [0,59].int
getMonth()
Month since January - [0,11].int
getSecond()
Second after the minute - [0,59].int
getYear()
Year since 0.Calendar
toCalendar()
Convert to calendar.String
toString()
String representation for debugging purpose.String
toStringReceiptDate()
Format as "day.mount.year" string for receipts.String
toStringReceiptTime()
Format as "hour:minute:second" string for receipts.String
toStringRegular()
Format as "day-month-year hour:minute:second" string.
-
-
-
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.
-
-
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.
-
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.
-
-