org.exoplatform.webui.utils
Class TimeConvertUtils

java.lang.Object
  extended by 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 Summary
static int DAY
           
static int MONTH
           
static String[] strs
           
static int WEEK
           
static int YEAR
           
 
Constructor Summary
TimeConvertUtils()
           
 
Method Summary
static String convertXTimeAgo(Date myDate, String format)
           
static String convertXTimeAgo(Date myDate, String format, int limit)
           
static String convertXTimeAgo(Date myDate, String format, Locale locale)
           
static String convertXTimeAgo(Date myDate, String format, Locale locale, int limit)
          Convert date to display string with format X time ago
static String getFormatDate(Date myDate, String format)
           
static String getFormatDate(Date myDate, String format, Locale locale)
           
static Calendar getGreenwichMeanTime()
          Get current time GMT/Zulu or UTC,(zone time is 0+GMT)
static Locale getLocale()
          Get current Locale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
                                     Locale locale)

convertXTimeAgo

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

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


Copyright © 2013 eXo Platform SAS. All Rights Reserved.