List of utility methods to do LocalDateTime Calculate
LocalDateTime | ms2LocalDateTime(final long ms) ms -> LocalDateTime object. return LocalDateTime.ofInstant(Instant.ofEpochMilli(ms), ZoneId.systemDefault());
|
String | oldDateToISO8601LocalDateTime(Date nextColumnDate) old Date To ISO Local Date Time LocalDateTime localDateTime = nextColumnDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
String formattedDate = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(localDateTime);
return formattedDate;
|
LocalDateTime | parseStringToLocalDateTimeWithSpecifiedTime(String strDate, String time) Parses a String into a LocalDateTime with a specified time return parseStringToLocalDateTime(strDate + " " + time); |
LocalDateTime | parseTimeStamp(LocalDateTime actualDate, LocalDateTime checkedDate, boolean isDateFrom) parse Time Stamp if (checkedDate != null && actualDate != null && checkIfDateExist(checkedDate) && !checkIfDateExist(actualDate)) { if (!isDateFrom) { actualDate = checkedDate.toLocalDate().atTime(actualDate.getHour(), actualDate.getMinute()); if (checkedDate != null && actualDate != null && checkIfTimeExist(checkedDate) && !checkIfTimeExist(actualDate)) { ... |
String | printDateTime(LocalDateTime dateTime) print Date Time return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
LocalDateTime | relativeDateTime(final LocalDateTime contextDate, final String str, final boolean add) relative Date Time LocalDateTime relativeDate = contextDate; if (str.equals("")) { return contextDate; try { final StringTokenizer st = new StringTokenizer(str.substring(1), " "); while (st.hasMoreTokens()) { final String token = st.nextToken(); ... |
LocalDateTime | safeCreateFromValue(LocalDateTime datetime, int year, int month, int day, int hour, int minute, int second) safe Create From Value if (isValidDate(year, month, day) && isValidTime(hour, minute, second)) { datetime = safeCreateFromValue(datetime, year, month, day); datetime = datetime.plusHours(hour - datetime.getHour()); datetime = datetime.plusMinutes((minute - datetime.getMinute())); datetime = datetime.plusSeconds(second - datetime.getSecond()); return datetime; |
long | secondsBetween(LocalDateTime date1, LocalDateTime date2) Calculate the time between two dates, in seconds return ChronoUnit.SECONDS.between(date1, date2);
|
LocalDateTime | setTime(LocalDateTime source, String time) set Time LocalTime tmp = LocalTime.parse(time, timeFormatter);
return source.withHour(tmp.getHour())
.withMinute(tmp.getMinute());
|
LocalDateTime | shiftDateTime(String timex, LocalDateTime reference, boolean future) shift Date Time ImmutableMap<String, Double> timexUnitMap = resolveDurationTimex(timex);
return getShiftResult(timexUnitMap, reference, future);
|