Class DateUtil

java.lang.Object
fr.paris.lutece.util.date.DateUtil

public final class DateUtil extends Object
This class provides date utils.
  • Field Details

  • Method Details

    • 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 format
      locale - 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 format
      locale - The Locale
      Returns:
      The Date or null else
    • formatTimestamp

      public static Timestamp formatTimestamp(String strDate, Locale locale)
      Get the Timestamp from String date The format pattern is specified internaly
      Parameters:
      strDate - the date to format
      locale - The Locale
      Returns:
      The Timestamp or null else
    • formatDateSql

      public static Date formatDateSql(String strDate, Locale locale)
      Get the Date from String date The format pattern is specified internaly
      Parameters:
      strDate - the date to format
      locale - The Locale
      Returns:
      The Date or 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 convert
      locale - 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 convert
      locale - 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 date
      locale - 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 Date or null if the string can't be parsed
      Since:
      7.0.1
    • getIsoDateString

      public static String getIsoDateString(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