Package tigase.util.datetime
Class TimestampHelper
- java.lang.Object
-
- tigase.util.datetime.TimestampHelper
-
public class TimestampHelper extends java.lang.Object- Author:
- andrzej
-
-
Constructor Summary
Constructors Constructor Description TimestampHelper()Creates helper configured to produce timestamps in UTC timezone.TimestampHelper(boolean useUTC)Creates helper configured to produce timestamps in UTC timezone or local timezone.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringformat(java.util.Date ts)java.lang.StringformatInLegacyDelayedDelivery(java.util.Date date)java.lang.StringformatWithMs(java.util.Date ts)booleanisUseUTC()java.util.DateparseTimestamp(java.lang.String tmp)voidsetUseUTC(boolean useUTC)Iffalsethen generated timestamps will be in local timezone.
-
-
-
Constructor Detail
-
TimestampHelper
public TimestampHelper()
Creates helper configured to produce timestamps in UTC timezone.- See Also:
setUseUTC(boolean)
-
TimestampHelper
public TimestampHelper(boolean useUTC)
Creates helper configured to produce timestamps in UTC timezone or local timezone.- Parameters:
useUTC-trueto use UTC timezone,falseto use local timezone.- See Also:
setUseUTC(boolean)
-
-
Method Detail
-
format
public java.lang.String format(java.util.Date ts)
-
formatInLegacyDelayedDelivery
public java.lang.String formatInLegacyDelayedDelivery(java.util.Date date)
-
formatWithMs
public java.lang.String formatWithMs(java.util.Date ts)
-
isUseUTC
public boolean isUseUTC()
-
setUseUTC
public void setUseUTC(boolean useUTC)
Iffalsethen generated timestamps will be in local timezone. In other case UTC will be used.trueby default.- Parameters:
useUTC-trueto use UTC timezone,falseto use local timezone.
-
parseTimestamp
public java.util.Date parseTimestamp(java.lang.String tmp) throws java.text.ParseException- Throws:
java.text.ParseException
-
-