Package com.helger.datetime.util
Class PDTIOHelper
- java.lang.Object
-
- com.helger.datetime.util.PDTIOHelper
-
@Immutable public final class PDTIOHelper extends Object
Some date time specific routines especially helpful for IO.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static StringPATTERN_DATEDate pattern suitable for generic sortingstatic StringPATTERN_DATETIMEDate and time pattern suitable for generic sortingstatic StringPATTERN_TIMETime pattern suitable for generic sorting
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetCurrentDateForFilename()static StringgetCurrentLocalDateTimeForFilename()static StringgetCurrentTimeForFilename()static StringgetDateForFilename(LocalDate aLocalDate)Get the passed date formatted suitable for a file name.static StringgetLocalDateTimeForFilename(LocalDateTime aDT)Get the passed local date time formatted suitable for a file name.static StringgetTimeForFilename(LocalTime aLocalTime)Get the passed time formatted suitable for a file name.
-
-
-
Field Detail
-
PATTERN_DATE
public static final String PATTERN_DATE
Date pattern suitable for generic sorting- See Also:
- Constant Field Values
-
PATTERN_TIME
public static final String PATTERN_TIME
Time pattern suitable for generic sorting- See Also:
- Constant Field Values
-
PATTERN_DATETIME
public static final String PATTERN_DATETIME
Date and time pattern suitable for generic sorting- See Also:
- Constant Field Values
-
-
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 patternYYYYMMDD_HHMMSS.- Parameters:
aDT- The local date time to be formatted. May not benull.- 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 patternYYYYMMDD.- Parameters:
aLocalDate- The date to be formatted. May not benull.- 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.
-
-