Package org.bgerp.util
Class TimeConvert
java.lang.Object
org.bgerp.util.TimeConvert
Date ant time converting utils.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final Date
Converts beginning of a day to date.static final Date
Converts the first day of a month to date.static Duration
toDuration
(LocalTime value) Converts a local time to duration between 0 and the timestatic final Instant
toInstant
(LocalDateTime value) Converts date and time to instant.static final LocalDate
toLocalDate
(Date value) Converts date to local date.static LocalTime
toLocalTime
(Duration duration) Converts a duration to time after adding the duration to 0static final Timestamp
toTimestamp
(Date value) Converts date to SQL timestamp.static final YearMonth
toYearMonth
(Date value) Converts date to month of year.
-
Constructor Details
-
TimeConvert
public TimeConvert()
-
-
Method Details
-
toYearMonth
Converts date to month of year.- Parameters:
value
-- Returns:
null
or month, containingvalue
.
-
toDate
Converts the first day of a month to date.- Parameters:
value
- the month.- Returns:
null
or date of the first day of the monthvalue
.
-
toDate
Converts beginning of a day to date.- Parameters:
value
- the day.- Returns:
null
or date of the beginning of the dayvalue
.
-
toLocalDate
Converts date to local date.- Parameters:
value
-- Returns:
null
or converted value.
-
toTimestamp
Converts date to SQL timestamp.- Parameters:
value
-- Returns:
null
or converted value.
-
toInstant
Converts date and time to instant.- Parameters:
value
-- Returns:
null
or converted value.
-
toDuration
Converts a local time to duration between 0 and the time- Parameters:
value
-- Returns:
-
toLocalTime
Converts a duration to time after adding the duration to 0- Parameters:
duration
-- Returns:
-