TimeTools (coding dates and time)

Use libraries in org.isf.utils.time.TimeTools class for convenients methods like

  • public static LocalDateTime getNow() <- to be used in place of standard LocalDateTime.now()

  • public static LocalDateTime getDateToday0()

  • public static LocalDateTime getDateToday24()

  • public static LocalDateTime getBeginningOfDay(LocalDateTime date)

  • public static LocalDateTime getBeginningOfNextDay(LocalDateTime date)

  • public static int getDaysBetweenDates(LocalDateTime from, LocalDateTime to)

  • public static int getWeeksBetweenDates(LocalDateTime from, LocalDateTime to)

  • public static int getMonthsBetweenDates(LocalDateTime from, LocalDateTime to)

  • public static boolean isSameDay(LocalDate aDate, LocalDate today)

  • public static boolean isSameDay(LocalDateTime aDate, LocalDateTime today)

  • etc…

The aim of this class is to standardize the way of managing dates and times within the whole application.

Important: getNow() methods should be used in place of standard LocalDateTime.now() because it forces time precision to SECONDS, regardless the JDK version and OS type (Linux, Windows, Mac they may provide different system clock precisions)

Open Hospital powered by ISF
ISF © Informatici Senza Frontiere - ONLUS