Modifier and Type | Field and Description |
---|---|
static long |
DAY_MILLISECONDS |
static int |
HOURS_PER_DAY |
static int |
MINUTES_PER_HOUR |
static int |
SECONDS_PER_DAY |
static int |
SECONDS_PER_MINUTE |
Constructor and Description |
---|
TimestampUtil() |
Modifier and Type | Method and Description |
---|---|
static Double |
convertDate(Date date)
Convert a
Date to a serial number. |
static Double |
convertDate(LocalDate date)
Convert a
LocalDate to a serial number. |
static Double |
convertDate(LocalDateTime date) |
static Double |
convertZonedDateTime(ChronoZonedDateTime<?> zdt)
Convert a
ChronoZonedDateTime to a serial number. |
public static final int SECONDS_PER_MINUTE
public static final int MINUTES_PER_HOUR
public static final int HOURS_PER_DAY
public static final int SECONDS_PER_DAY
public static final long DAY_MILLISECONDS
public static Double convertDate(Date date)
Date
to a serial number. Note Excel timestamps do not
carry any timezone information; this method uses the system timezone to
convert the timestamp to a serial number. If you need a specific
timezone, prefer using
convertZonedDateTime(java.time.chrono.ChronoZonedDateTime)
.date
- Date value.public static Double convertDate(LocalDateTime date)
public static Double convertDate(LocalDate date)
LocalDate
to a serial number.date
- Local date value.public static Double convertZonedDateTime(ChronoZonedDateTime<?> zdt)
ChronoZonedDateTime
to a serial number.zdt
- Date and timezone values.Copyright © 2023. All rights reserved.