Class TimeConvertUtils

java.lang.Object
org.exoplatform.webui.utils.TimeConvertUtils

public class TimeConvertUtils extends Object
Created by The eXo Platform SAS Author : Vu Duy Tu tu.duy@exoplatform.com Jul 5, 2011
  • Field Details

    • strs

      public static String[] strs
    • DAY

      public static int DAY
    • WEEK

      public static int WEEK
    • MONTH

      public static int MONTH
    • YEAR

      public static int YEAR
  • Constructor Details

    • TimeConvertUtils

      public TimeConvertUtils()
  • Method Details

    • convertXTimeAgo

      public static String convertXTimeAgo(Date myDate, String format)
    • convertXTimeAgo

      public static String convertXTimeAgo(Date myDate, String format, Locale locale)
    • convertXTimeAgo

      public static String convertXTimeAgo(Date myDate, String format, int limit)
    • convertXTimeAgoByTimeServer

      public static String convertXTimeAgoByTimeServer(Date myDate, String format, Locale locale, int limit)
      Convert date to display string with format X time ago
      Parameters:
      myDate - The object date input for convert, it must has ZoneTime is server ZoneTime
      format - The date/time format
      locale - The Local of current location(language/country).
      limit - The value set for limit convert x time ago. It must is: TimeConvertUtils.YEAR, MONTH, WEEK, DAY.
      Returns:
      String
    • convertXTimeAgo

      public static String convertXTimeAgo(Date myDate, String format, Locale locale, int limit)
      Convert date to display string with format X time ago
      Parameters:
      myDate - The object date input for convert, it must has ZoneTime is GMT+0
      format - The date/time format
      locale - The Local of current location(language/country).
      limit - The value set for limit convert x time ago. It must is: TimeConvertUtils.YEAR, MONTH, WEEK, DAY.
      Returns:
      String
    • getFormatDate

      public static String getFormatDate(Date myDate, String format)
    • getFormatDate

      public static String getFormatDate(Date myDate, String format, Locale locale)
    • getLocale

      public static Locale getLocale()
      Get current Locale
      Returns:
      Locale
    • getGreenwichMeanTime

      public static Calendar getGreenwichMeanTime()
      Get current time GMT/Zulu or UTC,(zone time is 0+GMT)
      Returns:
      Calendar
    • santializeJavaVariable

      public static String santializeJavaVariable(String input)
      Cleanup the string to be valid of Java variable Ex: input = "123 sdkjh s;:sdlkjh d" output = "_123_sdkjh_s__sdlkjh_d"
      Returns: