Package fr.paris.lutece.util.date
Class DateUtil
- java.lang.Object
-
- fr.paris.lutece.util.date.DateUtil
-
public final class DateUtil extends java.lang.ObjectThis class provides date utils.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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 java.util.DateformatDate(java.lang.String strDate, java.util.Locale locale)Get the date from String date The format pattern is specified internalystatic java.util.DateformatDateLongYear(java.lang.String strDate, java.util.Locale locale)Get the date from String datestatic java.sql.DateformatDateSql(java.lang.String strDate, java.util.Locale locale)Get theDatefrom String date The format pattern is specified internalystatic java.sql.TimestampformatTimestamp(java.lang.String strDate, java.util.Locale locale)Get theTimestampfrom String date The format pattern is specified internalystatic java.lang.StringgetCurrentDateString(java.util.Locale locale)Converts the current Date to a String datestatic java.text.DateFormatgetDateFormat(java.util.Locale locale)Get the Date format for the localestatic java.lang.StringgetDateString(long lTime, java.util.Locale locale)Converts a long value to a String datestatic java.lang.StringgetDateString(java.sql.Timestamp date, java.util.Locale locale)Converts a Timestamp value to a String datestatic java.lang.StringgetDateString(java.util.Date date, java.util.Locale locale)Convert the date to String with a standard patternstatic java.lang.StringgetDefaultPattern(java.util.Locale locale)Return the pattern for datestatic java.lang.StringgetIsoDateString(java.util.Date date)Get the ISO format ( yyyy-MM-dd HH:mm:ss ) of a datestatic java.util.DateparseIsoDate(java.lang.String strDate)Parse a date from ISO format ( yyyy-MM-dd HH:mm:ss )
-
-
-
Field Detail
-
ISO_PATTERN_DATE
public static final java.lang.String ISO_PATTERN_DATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
formatDate
public static java.util.Date formatDate(java.lang.String strDate, java.util.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 java.util.Date formatDateLongYear(java.lang.String strDate, java.util.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 java.sql.Timestamp formatTimestamp(java.lang.String strDate, java.util.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 java.sql.Date formatDateSql(java.lang.String strDate, java.util.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 java.lang.String getDateString(java.util.Date date, java.util.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 java.lang.String getDateString(long lTime, java.util.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 java.lang.String getDateString(java.sql.Timestamp date, java.util.Locale locale)Converts a Timestamp value to a String date- Parameters:
date- The datelocale- the locale- Returns:
- The formatted string
-
getCurrentDateString
public static java.lang.String getCurrentDateString(java.util.Locale locale)
Converts the current Date to a String date- Parameters:
locale- the locale- Returns:
- The formatted string
-
getDefaultPattern
public static java.lang.String getDefaultPattern(java.util.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 java.text.DateFormat getDateFormat(java.util.Locale locale)
Get the Date format for the locale- Parameters:
locale-- Returns:
-
parseIsoDate
public static java.util.Date parseIsoDate(java.lang.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
-
getIsoDateString
public static java.lang.String getIsoDateString(java.util.Date date)
Get the ISO format ( yyyy-MM-dd HH:mm:ss ) of a date- Parameters:
date-- Returns:
- string of the date in iso format, or null if param is null
- Since:
- 7.0.1
-
-