Class LoggingTimestampConversionUtils

java.lang.Object
kieker.common.util.dataformat.LoggingTimestampConversionUtils

public final class LoggingTimestampConversionUtils
extends java.lang.Object
This is a utility class which can be used to convert timestamps, for example by transforming a simple timestamp into a human-readable datetime string.
Since:
1.2
Author:
Andre van Hoorn
  • Method Summary

    Modifier and Type Method Description
    static java.util.Date convertDatetimeStringToUTCDate​(java.lang.String utcString)
    Converts a datetime string of format yyyyMMdd-HHmmss (UTC timezone) into a Date object.
    static long convertDatetimeStringToUTCLoggingTimestamp​(java.lang.String utcString)
    Converts a datetime string of format yyyyMMdd-HHmmss (UTC timezone) into a timestamp representing the number of nanoseconds since Jan 1, 1970 UTC.
    static java.lang.String convertLoggingTimestampLocalTimeZoneString​(long loggingTimestamp)
    Converts a timestamp representing the number of nanoseconds since Jan 1, 1970 UTC into a human-readable datetime string given in the local timezone.
    static java.lang.String convertLoggingTimestampToUTCString​(long loggingTimestamp)
    Converts a timestamp representing the number of nanoseconds since Jan 1, 1970 UTC into a human-readable datetime string given in the UTC timezone.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • convertLoggingTimestampToUTCString

      public static final java.lang.String convertLoggingTimestampToUTCString​(long loggingTimestamp)
      Converts a timestamp representing the number of nanoseconds since Jan 1, 1970 UTC into a human-readable datetime string given in the UTC timezone. Note that no guarantees are made about the actual format. Particularly, it is not guaranteed that the string can be reconverted using the convertDatetimeStringToUTCLoggingTimestamp(..) method.
      Parameters:
      loggingTimestamp - The timestamp to be converted in nanoseconds.
      Returns:
      a human-readable datetime string (UTC timezone) which represents the passed timestamp
    • convertLoggingTimestampLocalTimeZoneString

      public static final java.lang.String convertLoggingTimestampLocalTimeZoneString​(long loggingTimestamp)
      Converts a timestamp representing the number of nanoseconds since Jan 1, 1970 UTC into a human-readable datetime string given in the local timezone. Note that no guarantees are made about the actual format. Particularly, it is not guaranteed that the string can be reconverted using the convertDatetimeStringToUTCLoggingTimestamp(..) method.
      Parameters:
      loggingTimestamp - The timestamp to be converted.
      Returns:
      a human-readable datetime string (local timezone) which represents the passed timestamp
    • convertDatetimeStringToUTCLoggingTimestamp

      public static final long convertDatetimeStringToUTCLoggingTimestamp​(java.lang.String utcString) throws java.text.ParseException
      Converts a datetime string of format yyyyMMdd-HHmmss (UTC timezone) into a timestamp representing the number of nanoseconds since Jan 1, 1970 UTC.
      Parameters:
      utcString - The string to be converted.
      Returns:
      a timestamp which represents the passed time
      Throws:
      java.text.ParseException - If the specified string cannot be parsed.
    • convertDatetimeStringToUTCDate

      public static final java.util.Date convertDatetimeStringToUTCDate​(java.lang.String utcString) throws java.text.ParseException
      Converts a datetime string of format yyyyMMdd-HHmmss (UTC timezone) into a Date object.
      Parameters:
      utcString - The string to be converted.
      Returns:
      a Date object which represents the passed time
      Throws:
      java.text.ParseException - If the specified string cannot be parsed.