Package fr.paris.lutece.util.date
Class DateUtil
- java.lang.Object
-
- fr.paris.lutece.util.date.DateUtil
-
public final class DateUtil extends Object
This class provides date utils.
-
-
Field Summary
Fields Modifier and Type Field Description static StringISO_PATTERN_DATE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longconvertDaysInMiliseconds(long lDays)Get the number of milliseconds in a given number of daysstatic DateformatDate(String strDate, Locale locale)Get the date from String date The format pattern is specified internalystatic DateformatDateLongYear(String strDate, Locale locale)Get the date from String datestatic DateformatDateSql(String strDate, Locale locale)Get theDatefrom String date The format pattern is specified internalystatic TimestampformatTimestamp(String strDate, Locale locale)Get theTimestampfrom String date The format pattern is specified internalystatic StringgetCurrentDateString(Locale locale)Converts the current Date to a String datestatic DateFormatgetDateFormat(Locale locale)Get the Date format for the localestatic StringgetDateString(long lTime, Locale locale)Converts a long value to a String datestatic StringgetDateString(Timestamp date, Locale locale)Converts a Timestamp value to a String datestatic StringgetDateString(Date date, Locale locale)Convert the date to String with a standard patternstatic StringgetDefaultPattern(Locale locale)Return the pattern for datestatic StringgetIsoDateString(Date date)Get the ISO format ( yyyy-MM-dd HH:mm:ss ) of a datestatic DateparseIsoDate(String strDate)Parse a date from ISO format ( yyyy-MM-dd HH:mm:ss )
-
-
-
Field Detail
-
ISO_PATTERN_DATE
public static final String ISO_PATTERN_DATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
formatDate
public static Date formatDate(String strDate, Locale locale)
Get the date from String date The format pattern is specified internaly- Parameters:
strDate- the date to formatlocale- The Locale- Returns:
- The Date or null else
-
formatDateLongYear
public static Date formatDateLongYear(String strDate, Locale locale)
Get the date from String date- Parameters:
strDate- the date to formatlocale- The Locale- Returns:
- The Date or null else
-
formatTimestamp
public static Timestamp formatTimestamp(String strDate, Locale locale)
Get theTimestampfrom String date The format pattern is specified internaly- Parameters:
strDate- the date to formatlocale- The Locale- Returns:
- The
Timestampor null else
-
formatDateSql
public static Date formatDateSql(String strDate, Locale locale)
Get theDatefrom String date The format pattern is specified internaly- Parameters:
strDate- the date to formatlocale- The Locale- Returns:
- The
Dateor null else
-
getDateString
public static String getDateString(Date date, Locale locale)
Convert the date to String with a standard pattern- Parameters:
date- The date to convertlocale- The Locale- Returns:
- The formated String
-
getDateString
public static String getDateString(long lTime, Locale locale)
Converts a long value to a String date- Parameters:
lTime- The long value to convertlocale- the locale- Returns:
- The formatted string
-
getDateString
public static String getDateString(Timestamp date, Locale locale)
Converts a Timestamp value to a String date- Parameters:
date- The datelocale- the locale- Returns:
- The formatted string
-
getCurrentDateString
public static String getCurrentDateString(Locale locale)
Converts the current Date to a String date- Parameters:
locale- the locale- Returns:
- The formatted string
-
getDefaultPattern
public static String getDefaultPattern(Locale locale)
Return the pattern for date- Parameters:
locale- the Locale- Returns:
- The pattern as a String
-
convertDaysInMiliseconds
public static long convertDaysInMiliseconds(long lDays)
Get the number of milliseconds in a given number of days- Parameters:
lDays- The number of days- Returns:
- The number of milliseconds in the given number of days
-
getDateFormat
public static DateFormat getDateFormat(Locale locale)
Get the Date format for the locale- Parameters:
locale-- Returns:
-
parseIsoDate
public static Date parseIsoDate(String strDate)
Parse a date from ISO format ( yyyy-MM-dd HH:mm:ss )- Parameters:
strDate-- Returns:
- parsed
Dateor null if the string can't be parsed - Since:
- 7.0.1
-
-