@ApiStatus.Internal
public final class DateUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static @NotNull java.util.Date |
getCurrentDateTime()
Get the current date and time as ISO UTC
|
static @Nullable java.util.Date |
getCurrentDateTimeOrNull()
Get the current date and time as ISO UTC or null if not available
|
static @NotNull java.util.Date |
getDateTime(@NotNull java.util.Date date)
Converts the given Date and time to UTC timezone
|
static @NotNull java.util.Date |
getDateTime(@NotNull java.lang.String timestamp)
Get Java Date from UTC timestamp format
|
static @NotNull java.util.Date |
getDateTimeWithMillisPrecision(@NotNull java.lang.String timestamp)
Get Java Date from millis timestamp format
|
static @NotNull java.lang.String |
getTimestamp(@NotNull java.util.Date date)
Get date formatted as expected by Sentry.
|
static @NotNull java.lang.String |
getTimestampIsoFormat(@NotNull java.util.Date date)
Get date formatted as expected by Sentry.
|
@NotNull public static @NotNull java.lang.String getTimestampIsoFormat(@NotNull @NotNull java.util.Date date)
date
- the current date with local timezone@NotNull public static @NotNull java.util.Date getCurrentDateTime() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
@Nullable public static @Nullable java.util.Date getCurrentDateTimeOrNull() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
@NotNull public static @NotNull java.util.Date getDateTime(@NotNull @NotNull java.lang.String timestamp) throws java.lang.IllegalArgumentException
timestamp
- UTC format eg 2000-12-31T23:59:58Z or 2000-12-31T23:59:58.123Zjava.lang.IllegalArgumentException
@NotNull public static @NotNull java.util.Date getDateTimeWithMillisPrecision(@NotNull @NotNull java.lang.String timestamp) throws java.lang.IllegalArgumentException
timestamp
- millis format eg 1581410911.988 (1581410911 seconds and 988 millis)java.lang.IllegalArgumentException
@NotNull public static @NotNull java.lang.String getTimestamp(@NotNull @NotNull java.util.Date date)
date
- already UTC format@NotNull public static @NotNull java.util.Date getDateTime(@NotNull @NotNull java.util.Date date) throws java.lang.IllegalArgumentException
date
- the Date with local timezonejava.lang.IllegalArgumentException