List of utility methods to do Instant Format
String | format(Instant _instant, String _format) Return a string from Instant using format _format DateTimeFormatter format = DateTimeFormatter.ofPattern(_format); try { return LocalDateTime.ofInstant(_instant, localZoneOffset).format(format); } catch (DateTimeException exc) { System.out.printf("%s can't be formatted with pattern!%n", _instant, _format); throw exc; |
String | format(Instant instant) format return outputDateFormat.format(instant);
|
String | formatAtSAST(Instant instant, DateTimeFormatter format) format At SAST return instant.atZone(zoneSAST).format(format);
|
String | formatDate(Instant date, Locale locale) format Date return null;
|
String | formatDateForInstant(Instant instant) format Date For Instant try { LocalDateTime localDate = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy"); return localDate.format(formatter); } catch (DateTimeException ignored) { return "N/A"; |
String | formatHttpDate(Instant instant) format Http Date return DateTimeFormatter.RFC_1123_DATE_TIME.format(instant.atOffset(ZoneOffset.UTC));
|
String | formatInstant(TemporalAccessor instant) Formats the given instant to ISO8601 format including at least 3 positions for milliseconds. return ISO_UTC_DATE_TIME.format(instant);
|
String | formatIso8601Date(Instant date) Formats the specified date as an ISO 8601 string. return ISO_INSTANT.format(date);
|
String | formatTimeLocal(Instant instant) Returns the instant formatted as only time using the local timezone. DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
.withZone(ZoneId.systemDefault());
return formatter.format(instant);
|
Instant | parseInstant(String dateString, DateTimeFormatter formatter) parse Instant return formatter.withZone(ZoneOffset.UTC).parse(dateString, Instant::from);
|