Class TimeUtil


  • public class TimeUtil
    extends Object
    Operations for ZonedDateTime, Zone and MyDataTimeExpressions
    Author:
    Robin Brandstaedter
    • Constructor Detail

      • TimeUtil

        public TimeUtil()
    • Method Detail

      • parseExpressionToZonedDateTime

        public static java.time.ZonedDateTime parseExpressionToZonedDateTime​(String expression,
                                                                             java.time.ZonedDateTime timeRelativeTo)
        Parses the expression and returns the zoned date time.
        Parameters:
        expression - e.g., "10.10.2016 00:00:00", "*.-1.* *:*:*",...
        timeRelativeTo - the time relative to now/event
        Returns:
        the zoned date time
        Throws:
        IllegalArgumentException - the invalid format exception
      • getInterval

        public static TimeInterval getInterval​(String fixedExpression,
                                               java.time.ZonedDateTime timeRelativeTo)
      • getInterval

        public static TimeInterval getInterval​(String fixedExpression,
                                               java.time.ZonedDateTime timeRelativeTo,
                                               String sDayOfWeek)
      • getDynamicZonedDateTime

        public static java.time.ZonedDateTime getDynamicZonedDateTime​(Map<String,​String> expressionMap,
                                                                      java.time.ZonedDateTime timeRelativeTo)
      • addYear

        public static java.time.ZonedDateTime addYear​(int value,
                                                      java.time.ZonedDateTime aZonedDateTime)
      • addMonth

        public static java.time.ZonedDateTime addMonth​(int value,
                                                       java.time.ZonedDateTime aZonedDateTime)
      • addDay

        public static java.time.ZonedDateTime addDay​(int value,
                                                     java.time.ZonedDateTime aZonedDateTime)
      • addHours

        public static java.time.ZonedDateTime addHours​(int value,
                                                       java.time.ZonedDateTime aZonedDateTime)
      • addMinutes

        public static java.time.ZonedDateTime addMinutes​(int value,
                                                         java.time.ZonedDateTime aZonedDateTime)
      • addSeconds

        public static java.time.ZonedDateTime addSeconds​(int value,
                                                         java.time.ZonedDateTime aZonedDateTime)
      • addYear

        public static java.time.ZonedDateTime addYear​(String expressionValue,
                                                      java.time.ZonedDateTime aZonedDateTime)
      • getNow

        public static java.time.ZonedDateTime getNow​(String timezoneid)
      • getNow

        public static java.time.ZonedDateTime getNow​(java.time.ZoneId zoneId)
      • transferToZone

        public static java.time.ZonedDateTime transferToZone​(java.time.ZonedDateTime zdt,
                                                             String timeZoneId)
      • transferToZone

        public static java.time.ZonedDateTime transferToZone​(java.time.ZonedDateTime zdt,
                                                             java.time.ZoneId zoneId)
      • getHighestRelativeChangeUnit

        public static String getHighestRelativeChangeUnit​(TimeExpression timeExpression)
      • getLowestConcreteUnit

        public static String getLowestConcreteUnit​(TimeExpression timeExpression)
      • getValenceOfUnitString

        public static int getValenceOfUnitString​(String unit)
      • isValid

        public static boolean isValid​(TimeExpression timeExpression)
      • getZonedDateTime

        public static java.time.ZonedDateTime getZonedDateTime​(String dateString,
                                                               String timezoneid)
      • getZonedDateTime

        public static java.time.ZonedDateTime getZonedDateTime​(Timestamp ts,
                                                               String timezoneid)
      • getZonedDateTime

        public static java.time.ZonedDateTime getZonedDateTime​(String dateString,
                                                               java.time.ZoneId zoneId)
      • getMillisFromZonedDateTime

        public static long getMillisFromZonedDateTime​(java.time.ZonedDateTime zdt,
                                                      String targetZoneId)