Class PDTIOHelper


  • @Immutable
    public final class PDTIOHelper
    extends Object
    Some date time specific routines especially helpful for IO.
    Author:
    Philip Helger
    • Method Detail

      • getCurrentLocalDateTimeForFilename

        @Nonnull
        public static String getCurrentLocalDateTimeForFilename()
        Returns:
        The current local date time formatted for usage in a file name. It uses the pattern YYYYMMDD_HHMMSS.
      • getLocalDateTimeForFilename

        @Nonnull
        public static String getLocalDateTimeForFilename​(@Nonnull
                                                         LocalDateTime aDT)
        Get the passed local date time formatted suitable for a file name. It uses the pattern YYYYMMDD_HHMMSS.
        Parameters:
        aDT - The local date time to be formatted. May not be null.
        Returns:
        The formatted string.
      • getCurrentDateForFilename

        public static String getCurrentDateForFilename()
        Returns:
        The current date formatted for usage in a file name. It uses the pattern YYYYMMDD.
      • getDateForFilename

        public static String getDateForFilename​(@Nonnull
                                                LocalDate aLocalDate)
        Get the passed date formatted suitable for a file name. It uses the pattern YYYYMMDD.
        Parameters:
        aLocalDate - The date to be formatted. May not be null.
        Returns:
        The formatted string.
      • getCurrentTimeForFilename

        public static String getCurrentTimeForFilename()
        Returns:
        The current time formatted for usage in a file name. It uses the pattern HHMMSS.
      • getTimeForFilename

        public static String getTimeForFilename​(@Nonnull
                                                LocalTime aLocalTime)
        Get the passed time formatted suitable for a file name. It uses the pattern HHMMSS.
        Parameters:
        aLocalTime - The time to be formatted. May not be null.
        Returns:
        The formatted string.