Class TimestampFormatter


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

      • TimestampFormatter

        public TimestampFormatter()
    • Method Detail

      • 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​(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