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.String
format(java.util.Date ts)
java.lang.String
formatInLegacyDelayedDelivery(java.util.Date date)
java.lang.String
formatWithMs(java.util.Date ts)
boolean
isUseUTC()
java.util.Date
parseTimestamp(java.lang.String tmp)
void
setUseUTC(boolean useUTC)
Iffalse
then 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
-true
to use UTC timezone,false
to 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)
Iffalse
then generated timestamps will be in local timezone. In other case UTC will be used.true
by default.- Parameters:
useUTC
-true
to use UTC timezone,false
to use local timezone.
-
parseTimestamp
public java.util.Date parseTimestamp(java.lang.String tmp) throws java.text.ParseException
- Throws:
java.text.ParseException
-
-