Package org.exoplatform.webui.utils
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
-
-
Constructor Summary
Constructors Constructor Description TimeConvertUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringconvertXTimeAgo(Date myDate, String format)static StringconvertXTimeAgo(Date myDate, String format, int limit)static StringconvertXTimeAgo(Date myDate, String format, Locale locale)static StringconvertXTimeAgo(Date myDate, String format, Locale locale, int limit)Convert date to display string with format X time agostatic StringconvertXTimeAgoByTimeServer(Date myDate, String format, Locale locale, int limit)Convert date to display string with format X time agostatic StringgetFormatDate(Date myDate, String format)static StringgetFormatDate(Date myDate, String format, Locale locale)static CalendargetGreenwichMeanTime()Get current time GMT/Zulu or UTC,(zone time is 0+GMT)static LocalegetLocale()Get currentLocalestatic StringsantializeJavaVariable(String input)Cleanup the string to be valid of Java variable Ex: input = "123 sdkjh s;:sdlkjh d" output = "_123_sdkjh_s__sdlkjh_d"
-
-
-
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
-
-
Method Detail
-
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 ZoneTimeformat- The date/time formatlocale- 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+0format- The date/time formatlocale- 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
-
getGreenwichMeanTime
public static Calendar getGreenwichMeanTime()
Get current time GMT/Zulu or UTC,(zone time is 0+GMT)- Returns:
- Calendar
-
-