Package tigase.util.datetime

# Class TimestampHelper

java.lang.Object
tigase.util.datetime.TimestampHelper

public class TimestampHelper extends 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

  Modifier and Type
  Method
  Description
  `String`
  `format(Date ts)`
  `String`
  `formatInLegacyDelayedDelivery(Date date)`
  `String`
  `formatWithMs(Date ts)`
  `boolean`
  `isUseUTC()`
  `Date`
  `parseTimestamp(String tmp)`
  `void`
  `setUseUTC(boolean useUTC)`
  If `false` then generated timestamps will be in local timezone.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### 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 Details

  - ### format

    public String format(Date ts)

  - ### formatInLegacyDelayedDelivery

    public String formatInLegacyDelayedDelivery(Date date)

  - ### formatWithMs

    public String formatWithMs(Date ts)

  - ### isUseUTC

    public boolean isUseUTC()

  - ### setUseUTC

    public void setUseUTC(boolean useUTC)
    If `false` 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 Date parseTimestamp(String tmp) throws ParseException
    Throws:
      `ParseException`