Class Time
java.lang.Object
com.kosherjava.zmanim.util.Time
A class that represents a numeric time. Times that represent a time of day are stored as
Dates in
this API. The time class is used to represent numeric time such as the time in hours, minutes, seconds and
milliseconds of a temporal hour.- Author:
- © Eliyahu Hershfeld 2004 - 2025
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intmilliseconds in an hour.private intThe hour.private booleanIs the time negativeprivate intThe milliseconds.private static final intmilliseconds in a minute.private intThe minutes.private static final intmilliseconds in a second.private intThe seconds. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetHours()Get the hour.intGet the milliseconds.intGet the minutes.intGet the seconds.doublegetTime()Returns the time in milliseconds by converting hours, minutes and seconds into milliseconds.booleanDoes the time represent a negative time, such as using this to subtract time from another Time.voidsetHours(int hours) Set the hour.voidsetIsNegative(boolean isNegative) Set this to represent a negative time.voidsetMilliseconds(int milliseconds) Set the milliseconds.voidsetMinutes(int minutes) Set the minutes.voidsetSeconds(int seconds) Set the seconds.toString()
-
Field Details
-
SECOND_MILLIS
-
MINUTE_MILLIS
-
HOUR_MILLIS
-
hours
-
minutes
-
seconds
-
milliseconds
-
isNegative
-
-
Constructor Details
-
Time
Constructor with parameters for the hours, minutes, seconds and milliseconds.- Parameters:
hours- the hours to setminutes- the minutes to setseconds- the seconds to setmilliseconds- the milliseconds to set
-
Time
-
Time
A constructor that sets the time from milliseconds. The milliseconds are converted to hours, minutes, seconds and milliseconds. If the milliseconds are negative it will callsetIsNegative(boolean).- Parameters:
millis- the milliseconds to set.
-
-
Method Details
-
isNegative
Does the time represent a negative time, such as using this to subtract time from another Time.- Returns:
- if the time is negative.
-
setIsNegative
Set this to represent a negative time.- Parameters:
isNegative- that the Time represents negative time
-
getHours
-
setHours
-
getMinutes
-
setMinutes
-
getSeconds
-
setSeconds
-
getMilliseconds
-
setMilliseconds
Set the milliseconds.- Parameters:
milliseconds- The milliseconds to set.
-
getTime
Returns the time in milliseconds by converting hours, minutes and seconds into milliseconds.- Returns:
- the time in milliseconds
-
toString
-