public final class LocalDateUtil extends Object
Modifier and Type | Method and Description |
---|---|
static LocalDateTime |
fromDate(Date date) |
static LocalDateTime |
fromDate(FileTime fileTime) |
static LocalDateTime |
fromMillis(long millis) |
static Date |
getDate(LocalDateTime ldt) |
static Date |
getDate(String date) |
static String |
getFormattedDate(Date date) |
static String |
getFormattedDateForEsIndexes(LocalDateTime date)
Use to have homogeneous String date format on ES indexes
|
static String |
getFormattedDateForMongo(LocalDateTime date)
Use to have homogeneous String date format on database
|
static String |
getFormattedDateForMongo(String date)
Use to have homogeneous String date format on database
|
static long |
getMillis(LocalDateTime ldt) |
static Date |
getSimpleFormattedDate(String date) |
static String |
getString(Date date) |
static String |
getString(LocalDateTime localDateTime) |
static String |
getStringFormatted(LocalDateTime localDateTime) |
static LocalDateTime |
now() |
static LocalDateTime |
parseMongoFormattedDate(String str)
Parses a mongo formated date
|
static String |
transformIsoOffsetDateToIsoOffsetDateTime(String date)
Transform ISO_OFFSET_DATE to ISO_OFFSET_DATE_TIME
|
public static final String getString(LocalDateTime localDateTime)
localDateTime
- in format LocalDateTime to transformpublic static final String getStringFormatted(LocalDateTime localDateTime)
localDateTime
- in format LocalDateTime to transformpublic static String getString(Date date)
date
- in format date to transformpublic static LocalDateTime now()
public static Date getDate(String date) throws ParseException
date
- in format String to transformParseException
IllegalArgumentException
- date null or emptypublic static LocalDateTime fromMillis(long millis)
millis
- in format long to transformpublic static long getMillis(LocalDateTime ldt)
ldt
- in format LocalDateTime to transformIllegalArgumentException
- ldt null or emptypublic static LocalDateTime fromDate(Date date)
date
- in format Date to transformpublic static LocalDateTime fromDate(FileTime fileTime)
fileTime
- in format FileTime to transformpublic static Date getDate(LocalDateTime ldt)
ldt
- in format LocalDateTime to transformpublic static String getFormattedDate(Date date)
date
- datepublic static Date getSimpleFormattedDate(String date) throws ParseException
date
- dateParseException
public static String getFormattedDateForMongo(String date)
date
- the date to format for databaseDateTimeParseException
- thrown when cannot parse String date (not ISO_LOCAL_DATE_TIME, not
ZONED_DATE_TIME_FORMAT and not ISO_DATE date format)public static String transformIsoOffsetDateToIsoOffsetDateTime(String date)
date
- the date to format for elasticpublic static String getFormattedDateForMongo(LocalDateTime date)
date
- the date to format for databasepublic static LocalDateTime parseMongoFormattedDate(String str)
str
- formatted date in databasepublic static String getFormattedDateForEsIndexes(LocalDateTime date)
date
- the date to format for databaseCopyright © 2018 Vitam. All rights reserved.