public class UtilTime extends Object
Modifier and Type | Method and Description |
---|---|
static ZonedDateTime |
earliestOf(Collection<ZonedDateTime> datetimes) |
static ZonedDateTime |
earliestOf(ZonedDateTime a,
ZonedDateTime b) |
static long |
elapsedDurationSeconds(String timestamp) |
static ZonedDateTime |
getDate(String date)
Extract an iso date.
|
static String |
getShortDate(long ms)
Given 1573272121048 you will get "2019-11-09-05h02"
|
static String |
getShortDate(ZonedDateTime zdt)
Given a
ZonedDateTime returns a suffix like "2019-11-09-05h02" |
static ZonedDateTime |
latestOf(Collection<ZonedDateTime> datetimes) |
static ZonedDateTime |
latestOf(ZonedDateTime a,
ZonedDateTime b) |
static String |
now() |
static ZonedDateTime |
parseDateWithDefaultFormatter(String date)
Parse a date with the default ISO date time formatter.
|
static ZonedDateTime |
toZonedDateTime(String timestamp) |
public static ZonedDateTime earliestOf(ZonedDateTime a, ZonedDateTime b)
a
- the first dateb
- the second datepublic static ZonedDateTime latestOf(ZonedDateTime a, ZonedDateTime b)
a
- the first dateb
- the second datepublic static ZonedDateTime earliestOf(Collection<ZonedDateTime> datetimes)
datetimes
- the dates collectionpublic static ZonedDateTime latestOf(Collection<ZonedDateTime> datetimes)
datetimes
- the dates collectionpublic static String now()
public static long elapsedDurationSeconds(String timestamp)
an
- iso timestamppublic static String getShortDate(long ms)
ms
- a long timestamppublic static String getShortDate(ZonedDateTime zdt)
ZonedDateTime
returns a suffix like "2019-11-09-05h02"zdt
- a ZonedDateTime
public static ZonedDateTime getDate(String date)
date
- datepublic static ZonedDateTime toZonedDateTime(String timestamp)
timestamp
- a valid timstamp, formatted in UTC, i.e: 2020-06-16T13:01:10.442Zpublic static ZonedDateTime parseDateWithDefaultFormatter(String date)
date
- a dateCopyright © 2014–2023. All rights reserved.