Package org.quartz
Class TimeOfDay
- java.lang.Object
-
- org.quartz.TimeOfDay
-
- All Implemented Interfaces:
java.io.Serializable
public class TimeOfDay extends java.lang.Object implements java.io.SerializableRepresents a time in hour, minute and second of any given day.The hour is in 24-hour convention, meaning values are from 0 to 23.
- Since:
- 2.0.3
- Author:
- James House, Zemian Deng <[email protected]>
- See Also:
DailyTimeIntervalScheduleBuilder, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbefore(TimeOfDay timeOfDay)Determine with this time of day is before the given time of day.booleanequals(java.lang.Object obj)intgetHour()The hour of the day (between 0 and 23).intgetMinute()The minute of the hour.intgetSecond()The second of the minute.java.util.DategetTimeOfDayForDate(java.util.Date dateTime)Return a date with time of day reset to this object values.inthashCode()static TimeOfDayhourAndMinuteAndSecondFromDate(java.util.Date dateTime)Create a TimeOfDay from the given date, in the system default TimeZone.static TimeOfDayhourAndMinuteAndSecondFromDate(java.util.Date dateTime, java.util.TimeZone tz)Create a TimeOfDay from the given date, in the given TimeZone.static TimeOfDayhourAndMinuteFromDate(java.util.Date dateTime)Create a TimeOfDay from the given date (at the zero-second), in the system default TimeZone.static TimeOfDayhourAndMinuteFromDate(java.util.Date dateTime, java.util.TimeZone tz)Create a TimeOfDay from the given date (at the zero-second), in the system default TimeZone.static TimeOfDayhourAndMinuteOfDay(int hour, int minute)Create a TimeOfDay instance for the given hour and minute (at the zero second of the minute).static TimeOfDayhourMinuteAndSecondOfDay(int hour, int minute, int second)Create a TimeOfDay instance for the given hour, minute and second.java.lang.StringtoString()
-
-
-
Constructor Detail
-
TimeOfDay
public TimeOfDay(int hour, int minute, int second)Create a TimeOfDay instance for the given hour, minute and second.- Parameters:
hour- The hour of day, between 0 and 23.minute- The minute of the hour, between 0 and 59.second- The second of the minute, between 0 and 59.- Throws:
java.lang.IllegalArgumentException- if one or more of the input values is out of their valid range.
-
TimeOfDay
public TimeOfDay(int hour, int minute)Create a TimeOfDay instance for the given hour and minute (at the zero second of the minute).- Parameters:
hour- The hour of day, between 0 and 23.minute- The minute of the hour, between 0 and 59.- Throws:
java.lang.IllegalArgumentException- if one or more of the input values is out of their valid range.
-
-
Method Detail
-
hourMinuteAndSecondOfDay
public static TimeOfDay hourMinuteAndSecondOfDay(int hour, int minute, int second)
Create a TimeOfDay instance for the given hour, minute and second.- Parameters:
hour- The hour of day, between 0 and 23.minute- The minute of the hour, between 0 and 59.second- The second of the minute, between 0 and 59.- Throws:
java.lang.IllegalArgumentException- if one or more of the input values is out of their valid range.
-
hourAndMinuteOfDay
public static TimeOfDay hourAndMinuteOfDay(int hour, int minute)
Create a TimeOfDay instance for the given hour and minute (at the zero second of the minute).- Parameters:
hour- The hour of day, between 0 and 23.minute- The minute of the hour, between 0 and 59.- Throws:
java.lang.IllegalArgumentException- if one or more of the input values is out of their valid range.
-
getHour
public int getHour()
The hour of the day (between 0 and 23).- Returns:
- The hour of the day (between 0 and 23).
-
getMinute
public int getMinute()
The minute of the hour.- Returns:
- The minute of the hour (between 0 and 59).
-
getSecond
public int getSecond()
The second of the minute.- Returns:
- The second of the minute (between 0 and 59).
-
before
public boolean before(TimeOfDay timeOfDay)
Determine with this time of day is before the given time of day.- Returns:
- true this time of day is before the given time of day.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getTimeOfDayForDate
public java.util.Date getTimeOfDayForDate(java.util.Date dateTime)
Return a date with time of day reset to this object values. The millisecond value will be zero.
-
hourAndMinuteAndSecondFromDate
public static TimeOfDay hourAndMinuteAndSecondFromDate(java.util.Date dateTime)
Create a TimeOfDay from the given date, in the system default TimeZone.- Parameters:
dateTime- The java.util.Date from which to extract Hour, Minute and Second.
-
hourAndMinuteAndSecondFromDate
public static TimeOfDay hourAndMinuteAndSecondFromDate(java.util.Date dateTime, java.util.TimeZone tz)
Create a TimeOfDay from the given date, in the given TimeZone.- Parameters:
dateTime- The java.util.Date from which to extract Hour, Minute and Second.tz- The TimeZone from which relate Hour, Minute and Second for the given date. If null, system default TimeZone will be used.
-
hourAndMinuteFromDate
public static TimeOfDay hourAndMinuteFromDate(java.util.Date dateTime)
Create a TimeOfDay from the given date (at the zero-second), in the system default TimeZone.- Parameters:
dateTime- The java.util.Date from which to extract Hour and Minute.
-
hourAndMinuteFromDate
public static TimeOfDay hourAndMinuteFromDate(java.util.Date dateTime, java.util.TimeZone tz)
Create a TimeOfDay from the given date (at the zero-second), in the system default TimeZone.- Parameters:
dateTime- The java.util.Date from which to extract Hour and Minute.tz- The TimeZone from which relate Hour and Minute for the given date. If null, system default TimeZone will be used.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-