List of utility methods to do DateTimeFormatter
DateTimeFormatter | getFullFormatter() get Full Formatter return DateTimeFormatter.ofPattern(FULL_PATTERN).withLocale(Locale.FRANCE);
|
DateTimeFormatter | getGermanFormatter() get German Formatter return germanFormatter;
|
ChronoUnit | getIndexGroupingPeriod_slow(String date_format) Utility function to figure out the grouping period based on the index name final SimpleDateFormat d = new SimpleDateFormat(date_format); final long try_date_boxes[] = { 3601L, 25L * 3600L, 8L * 24L * 3600L, 32L * 24L * 3600L, 367L * 34L * 3600L }; final ChronoUnit ret_date_boxes[] = { ChronoUnit.HOURS, ChronoUnit.DAYS, ChronoUnit.WEEKS, ChronoUnit.MONTHS, ChronoUnit.YEARS }; final Date now = new Date(); final String now_string = d.format(now); for (int i = 0; i < try_date_boxes.length; ++i) { ... |
DateTimeFormatter | getLocalizedDateFormat(final Locale LOCALE) get Localized Date Format return DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).withLocale(LOCALE);
|
LocalTime | getParsedTimeOrNull(String timeText, DateTimeFormatter formatForDisplayTime, DateTimeFormatter formatForMenuTimes, ArrayList get Parsed Time Or Null if (timeText == null || timeText.trim().isEmpty()) { return null; timeText = timeText.trim().toLowerCase(); LocalTime parsedTime = null; if (parsedTime == null) { try { parsedTime = LocalTime.parse(timeText, formatForDisplayTime); ... |
DateTimeFormatter | getPreferredDateFormat() get Preferred Date Format return preferredDateFormat;
|
DateTimeFormatter | getShortDateManualEntryFormatter() get Short Date Manual Entry Formatter return shortDateManualEntryFormatter;
|
DateTimeFormatter | getShortFormatter(Locale locale) get Short Formatter String pattern = SHORT_PATTERN_EN; if (Locale.FRANCE.equals(locale)) pattern = SHORT_PATTERN_FR; return DateTimeFormatter.ofPattern(pattern); |
Date | getStartOfDay(Date dateToFormat) Retuns the start of day in Date format. assert dateToFormat != null : "Date to be formatted should not be null"; LocalDate date = dateToFormat.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); return Date.from(date.atStartOfDay(ZoneId.systemDefault()).toInstant()); |
LocalTime | getTime(final String time, final DateTimeFormatter formatter) get Time return time != null ? LocalTime.parse(time, formatter) : null;
|