Package io.jmix.core
Class DateTimeTransformations
java.lang.Object
io.jmix.core.DateTimeTransformations
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isDateTypeSupportsTimeZones
(Class javaType) Check if date type supports time zone conversationtransformFromLocalTime
(LocalTime localTime, Class javaType) Obtains an instance of specified by type date object from from LocalTimetransformFromZDT
(ZonedDateTime zonedDateTime, Class javaType) Obtains an instance of specified by type date object from from ZonedDateTime LocalDate, LocalDateTime is created for default system timezoneprotected Object
transformFromZdtInternal
(ZonedDateTime zonedDateTime, Class javaType) transformToLocalTime
(Object date) Obtains an instance of LocalTime from Time or Date or LocalTime or OffsetTimetransformToType
(Object date, Class javaType, ZoneId zoneId) Converts a date instance to the passed java type corresponding to one of the date types.transformToZDT
(Object date) Obtains an instance of ZonedDateTime from Date or LocalDate or LocalDateTime or OffsetDateTime ZonedDateTime is created for LocalDate, LocalDateTime with default system timezoneprotected ZonedDateTime
transformToZDT
(Object date, ZoneId fromZoneId)
-
Constructor Details
-
DateTimeTransformations
public DateTimeTransformations()
-
-
Method Details
-
transformToType
Converts a date instance to the passed java type corresponding to one of the date types.- Parameters:
date
- the date object, notnull
javaType
- the java type to convert tozoneId
- the zone ID to use ornull
to use default system timezone- Returns:
- the date object converted to the passed java type, not
null
-
transformToZDT
Obtains an instance of ZonedDateTime from Date or LocalDate or LocalDateTime or OffsetDateTime ZonedDateTime is created for LocalDate, LocalDateTime with default system timezone- Parameters:
date
- date object, not null- Returns:
- the ZonedDateTime, not null
-
transformToZDT
-
transformFromZDT
Obtains an instance of specified by type date object from from ZonedDateTime LocalDate, LocalDateTime is created for default system timezone- Parameters:
zonedDateTime
- date object, not nulljavaType
- date type to transformation from ZonedDateTime- Returns:
- the date object, not null
-
transformFromZdtInternal
-
transformToLocalTime
Obtains an instance of LocalTime from Time or Date or LocalTime or OffsetTime- Parameters:
date
- date object, not null- Returns:
- the LocalTime, not null
-
transformFromLocalTime
Obtains an instance of specified by type date object from from LocalTime- Parameters:
localTime
- date object, not nulljavaType
- date type to transformation from LocalTime- Returns:
- the date object, not null
-
isDateTypeSupportsTimeZones
Check if date type supports time zone conversation- Parameters:
javaType
- - date type- Returns:
- true - if date type supports timezones
-