List of utility methods to do LocalDateTime to
Date | toDate(LocalDateTime dateTime) to Date return Date.from(dateTime.toInstant(ZoneOffset.UTC));
|
Date | toDate(LocalDateTime ldt) to Date ZonedDateTime zdt = ZonedDateTime.of(ldt, ZoneId.systemDefault());
GregorianCalendar cal = GregorianCalendar.from(zdt);
return cal.getTime();
|
String | toDateHeader(LocalDateTime dt) to Date Header return String.format("%s, %02d %s %d %s GMT", dt.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.ENGLISH), dt.getDayOfMonth(), dt.getMonth().getDisplayName(TextStyle.SHORT, Locale.ENGLISH), dt.getYear(), dt.toLocalTime()); |
Date | toDateUTCFromJST(LocalDateTime dateTime) to Date UTC From JST if (dateTime == null) { return null; ZonedDateTime zonedDateTime = dateTime.atZone(ZONEID_JST); return Date.from(zonedDateTime.toInstant()); |
LocalDateTime | toJava8(org.joda.time.LocalDateTime x) to Java if (x == null) return null; return toLocalDateTime(x.toDate().getTime()); |
String | toJsonDate(LocalDateTime date) Generate a JSON-formatted date string for a given date return jsonFormatter.format(date);
|
boolean | tokenExpired(LocalDateTime expiryDate) token Expired return expiryDate.isBefore(LocalDateTime.now());
|
long | toMinuteCount(LocalDateTime ldt) to Minute Count return ldt.toInstant(OFFSET).getEpochSecond() / 60;
|
String | toString(LocalDateTime time) to String return toString(time, "yyyy/MM/dd HH:mm:ss"); |
String | toStringIfPresent(LocalDateTime dateTime) to String If Present if (dateTime != null) { return dateTime.toString(); } else { return null; |