Class DateTime

java.lang.Object
com.espertech.esper.common.client.util.DateTime

public class DateTime extends Object
Utility class for date-time functions.
  • Field Details

    • DEFAULT_XMLLIKE_DATE_FORMAT

      public static final String DEFAULT_XMLLIKE_DATE_FORMAT
      The default date-time format.
      See Also:
    • DEFAULT_XMLLIKE_DATE_FORMAT_WITH_ZONE

      public static final String DEFAULT_XMLLIKE_DATE_FORMAT_WITH_ZONE
      The default date-time format with time zone.
      See Also:
  • Constructor Details

    • DateTime

      public DateTime()
  • Method Details

    • toCalendar

      public static Calendar toCalendar(String datestring)
      Returns a calendar from a given string using the default SimpleDateFormat for parsing.
      Parameters:
      datestring - to parse
      Returns:
      calendar
    • toCalendar

      public static Calendar toCalendar(String datestring, String format)
      Returns a calendar from a given string using the provided format.
      Parameters:
      datestring - to parse
      format - to use for parsing
      Returns:
      calendar
    • toDate

      public static Date toDate(String datestring)
      Returns a date from a given string using the default SimpleDateFormat for parsing.
      Parameters:
      datestring - to parse
      Returns:
      date object
    • toDate

      public static Date toDate(String datestring, String format)
      Returns a date from a given string using the provided format.
      Parameters:
      datestring - to parse
      format - to use for parsing
      Returns:
      date object
    • toMillisec

      public static Long toMillisec(String datestring)
      Returns a long-millisecond value from a given string using the default SimpleDateFormat for parsing.
      Parameters:
      datestring - to parse
      Returns:
      long msec
    • toMillisec

      public static Long toMillisec(String datestring, String format)
      Returns a long-millisecond value from a given string using the provided format.
      Parameters:
      datestring - to parse
      format - to use for parsing
      Returns:
      long msec
    • print

      public static String print(Object date)
      Print the provided date object using the default date format DEFAULT_XMLLIKE_DATE_FORMAT
      Parameters:
      date - should be long, Date or Calendar
      Returns:
      date string
    • printWithZone

      public static String printWithZone(Object date)
      Print the provided date object using the default date format DEFAULT_XMLLIKE_DATE_FORMAT
      Parameters:
      date - should be long, Date or Calendar
      Returns:
      date string
    • parseDefaultMSec

      public static long parseDefaultMSec(String dateTime)
      Parse the date-time string using DEFAULT_XMLLIKE_DATE_FORMAT.
      Parameters:
      dateTime - date-time string
      Returns:
      milliseconds
    • parseDefaultLocalDateTime

      public static LocalDateTime parseDefaultLocalDateTime(String dateTime)
      Parse the date-time string using DEFAULT_XMLLIKE_DATE_FORMAT.
      Parameters:
      dateTime - date-time string
      Returns:
      LocalDateTime
    • parseDefaultZonedDateTime

      public static ZonedDateTime parseDefaultZonedDateTime(String dateTime)
      Parse the date-time string using DEFAULT_XMLLIKE_DATE_FORMAT assume System default time zone
      Parameters:
      dateTime - date-time string
      Returns:
      ZonedDateTime
    • parseDefaultMSecWZone

      public static long parseDefaultMSecWZone(String dateTimeWithZone)
      Parse the date-time string using DEFAULT_XMLLIKE_DATE_FORMAT_WITH_ZONE.
      Parameters:
      dateTimeWithZone - date-time string
      Returns:
      milliseconds
    • parseDefaultDate

      public static Date parseDefaultDate(String dateTime)
      Parse the date-time string using DEFAULT_XMLLIKE_DATE_FORMAT.
      Parameters:
      dateTime - date-time string
      Returns:
      date
    • parseDefaultCal

      public static Calendar parseDefaultCal(String dateTime)
      Parse the date-time string using DEFAULT_XMLLIKE_DATE_FORMAT.
      Parameters:
      dateTime - date-time string
      Returns:
      calendar