Class DateFormatter


  • public class DateFormatter
    extends java.lang.Object
    Date-time String formatter utility class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String format​(long timestamp)  
      static java.lang.String format​(java.time.Instant instant)  
      static java.lang.String now()  
      static long parse​(java.lang.String datetime)  
      • Methods inherited from class java.lang.Object

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

      • now

        public static java.lang.String now()
        Returns:
        a String representing the current datetime
      • format

        public static java.lang.String format​(long timestamp)
        Returns:
        a String representing a particular timestamp (in milliseconds)
      • format

        public static java.lang.String format​(java.time.Instant instant)
        Returns:
        a String representing a particular time instant
      • parse

        public static long parse​(java.lang.String datetime)
                          throws java.time.format.DateTimeParseException
        Parameters:
        datetime -
        Returns:
        the parsed timestamp (in milliseconds) of the provided datetime
        Throws:
        java.time.format.DateTimeParseException