public interface DateTimeUtils
Modifier and Type | Field and Description |
---|---|
static long |
SECONDS_PER_DAY |
Modifier and Type | Method and Description |
---|---|
static LocalDate |
LocalDateOfInstant(Instant instant,
ZoneId zone) |
static @NotNull String |
localeToDateFormat(Locale locale)
Get the Date's pattern from a Locale object
|
static @NotNull Date |
stringToDate(String string,
Locale locale)
Parses a String to a Date object, using the pattern related to a locale object
|
static @NotNull Date |
stringToDate(String string,
String pattern)
Parses a String to a Date object, using the pattern related to a locale object
|
static @NotNull LocalDate |
stringToLocalDate(String string,
Locale locale)
Parses a String to a LocalDate object, using the pattern related to a locale object
|
static @NotNull LocalDate |
stringToLocalDate(String string,
String pattern)
Parses a String to a LocalDate object, using the pattern related to a locale object
|
static @NotNull LocalTime |
stringToLocalTime(@NotNull String string)
Converts a String into a LocalTime object
|
static @NotNull String |
toDiscordTimeStamp(@NotNull Date date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull Date date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull LocalDate date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull LocalDateTime date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull LocalDate date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull LocalDateTime date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull LocalTime time)
Converts most Time object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(Long date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(Long date,
@NotNull net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull OffsetDateTime date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull OffsetDateTime date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull OffsetTime time)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull OffsetTime date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull Timestamp date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull Timestamp date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull ZonedDateTime date)
Converts most Date object types to a Discord Timestamp
|
static @NotNull String |
toDiscordTimeStamp(@NotNull ZonedDateTime date,
net.dv8tion.jda.api.utils.TimeFormat format)
Converts most Date object types to a Discord Timestamp
|
static long |
toEpochSecond(LocalDate date,
LocalTime time,
ZoneOffset offset) |
static long |
toEpochSecond(LocalTime time,
LocalDate date,
ZoneOffset offset) |
static long |
toEpochSecond(OffsetTime time,
LocalDate date) |
static long |
toEpochSecond(OffsetTime time,
LocalDate date,
ZoneOffset offset) |
static final long SECONDS_PER_DAY
@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull Date date)
date
- date Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull OffsetDateTime date)
date
- date Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull OffsetTime time)
time
- OffsetTime Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull ZonedDateTime date)
date
- date Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull LocalDate date)
date
- date Objectstatic long toEpochSecond(OffsetTime time, LocalDate date)
static long toEpochSecond(OffsetTime time, LocalDate date, ZoneOffset offset)
static long toEpochSecond(LocalTime time, LocalDate date, ZoneOffset offset)
static long toEpochSecond(LocalDate date, LocalTime time, ZoneOffset offset)
@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull LocalTime time)
time
- time Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull LocalDateTime date)
date
- date Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull Timestamp date)
date
- date Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(Long date)
date
- date Object@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull Date date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull OffsetDateTime date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull OffsetTime date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull ZonedDateTime date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull LocalDate date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull LocalDateTime date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(@NotNull @NotNull Timestamp date, net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@Contract(pure=true) @NotNull static @NotNull String toDiscordTimeStamp(Long date, @NotNull @NotNull net.dv8tion.jda.api.utils.TimeFormat format)
date
- date Objectformat
- Markdown styles for timestamps used to represent a unix epoch timestamp in different formats.@NotNull static @NotNull Date stringToDate(String string, Locale locale) throws ParseException
string
- String representation of a datelocale
- Localization object to extract date patternParseException
- Thrown when the parse fails.@NotNull static @NotNull Date stringToDate(String string, String pattern) throws ParseException
string
- String representation of a datepattern
- String Date's patternParseException
- Thrown when the parse fails.@NotNull static @NotNull LocalDate stringToLocalDate(String string, Locale locale) throws ParseException
string
- String representation of a datelocale
- Localization object to extract date patternParseException
- Thrown when the parse fails.@NotNull static @NotNull LocalDate stringToLocalDate(String string, String pattern) throws ParseException
string
- String representation of a datepattern
- String Date's patternParseException
- Thrown when the parse fails.@NotNull static @NotNull String localeToDateFormat(Locale locale)
locale
- Locale target