Class TimeConvertUtils


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

      • 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 Detail

      • TimeConvertUtils

        public TimeConvertUtils()
    • Method Detail

      • convertXTimeAgo

        public static String convertXTimeAgo​(Date myDate,
                                             String format)
      • 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)
      • 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: