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
Date
s 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 int
milliseconds in an hour.private int
The hour.private boolean
Is the time negativeprivate int
The milliseconds.private static final int
milliseconds in a minute.private int
The minutes.private static final int
milliseconds in a second.private int
The seconds. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getHours()
Get the hour.int
Get the milliseconds.int
Get the minutes.int
Get the seconds.double
getTime()
Returns the time in milliseconds by converting hours, minutes and seconds into milliseconds.boolean
Does the time represent a negative time, such as using this to subtract time from another Time.void
setHours
(int hours) Set the hour.void
setIsNegative
(boolean isNegative) Set this to represent a negative time.void
setMilliseconds
(int milliseconds) Set the milliseconds.void
setMinutes
(int minutes) Set the minutes.void
setSeconds
(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
-