Class TimestampFormatter

java.lang.Object
org.heigit.ohsome.ohsomeapi.utils.TimestampFormatter

public class TimestampFormatter extends Object
A helper class to transform timestamps between string, date and long.
  • Constructor Details

    • TimestampFormatter

      public TimestampFormatter()
  • Method Details

    • getInstance

      public static TimestampFormatter getInstance()
      Get a standard TimestampFormatter.
      Returns:
      a timestamp formatter object
    • date

      public String date(Date date)
      Converts a date to the format yyyy-MM-dd.
      Parameters:
      date - the date to be printed
      Returns:
      the formatted date string
    • isoDateTime

      public String isoDateTime(Date date)
      Converts a date to the format yyyy-MM-dd'T'HH:mm:ss'Z'.
      Parameters:
      date - the date to be printed
      Returns:
      the formatted date string
    • isoDateTime

      public String isoDateTime(long timestamp)
      Converts a unix-timestamp (oshdb-timestamp) to the format yyyy-MM-dd'T'HH:mm:ss'Z' (OSM-Timestamp).
      Parameters:
      timestamp - the timestamp to be printed
      Returns:
      the formatted date string
    • isoDateTime

      public String isoDateTime(org.heigit.ohsome.oshdb.OSHDBTimestamp date)
      Converts a date to the format yyyy-MM-dd'T'HH:mm:ss'Z'.
      Parameters:
      date - the date to be printed
      Returns:
      the formatted date string