Java Utililty Methods LocalDateTime Calculate

List of utility methods to do LocalDateTime Calculate

Description

The list of methods to do LocalDateTime Calculate are organized into topic(s).

Method

StringconvertDatabaseDateToUSTime(LocalDateTime databaseDate)
convert Database Date To US Time
if (databaseDate != null) {
    return databaseDate.format(DateTimeFormatter.ofPattern("hh:mm a"));
} else {
    return "";
LocalDateTimeconverterZoneDatetimeToLocalDateTime(final String date)
converter Zone Datetime To Local Date Time
ZonedDateTime zdt = ZonedDateTime.parse(date);
return zdt.toLocalDateTime();
longcurrentTimeMillis(LocalDateTime ldt)
current Time Millis
return ldt.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
LocalDateTimeDateTime2LocalDateTime(Date datetime)
Date Time Local Date Time
Instant timestamp = datetime.toInstant();
LocalDateTime localDateTime = LocalDateTime.ofInstant(timestamp, ZoneId.of(ZoneId.SHORT_IDS.get("CTT")));
return localDateTime;
longdateTimeToOleMinutes(LocalDateTime datetime)
date Time To Ole Minutes
return Duration.between(OLE_AUTOMATION_TIME_START, datetime).toMinutes();
longdayDuration(LocalDateTime startDateTime, LocalDateTime endDateTime)
day Duration
return duration(startDateTime, endDateTime).toDays();
char[]fastDateTimeWriteHours(LocalDateTime localDateTime)
fast Date Time Write Hours
char[] c = new char[13];
LocalDate localDate = localDateTime.toLocalDate();
int y = localDate.getYear();
c[0] = (char) ('0' + y / 1000);
c[1] = (char) ('0' + ((y % 1000) / 100));
c[2] = (char) ('0' + ((y % 100) / 10));
c[3] = (char) ('0' + (y % 10));
c[4] = (char) ('-');
...
LocalDateTimegetShiftResult(ImmutableMap timexUnitMap, LocalDateTime reference, boolean future)
get Shift Result
LocalDateTime result = reference;
int futureOrPast = future ? 1 : -1;
for (Map.Entry<String, Double> pair : timexUnitMap.entrySet()) {
    String unit = pair.getKey();
    Double number = pair.getValue();
    switch (unit) {
    case "H":
        result = result.plusHours(Math.round(number * futureOrPast));
...
intgetStartWeekOfMonth(@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
Get the start--week number for the passed year and month.
return getWeekOfWeekBasedYear(aDT.withDayOfMonth(1), aLocale);
LocalTimegetTimePart(final LocalDateTime dateTime)
get Time Part
return dateTime.toLocalTime();