Package tilda.utils

Class DateTimeUtil


  • public class DateTimeUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      DateTimeUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.time.ZonedDateTime addRandomDeltaDays​(java.time.ZonedDateTime ZDT, int minDays, int maxDays, int minHour, int maxHour)
      Adds/substract randomly between minDays and maxDays number of days to this date and sets the hours within the range prescribed (min/maxHours), and a randomly selected minute between 0 and 60.
      static java.time.ZonedDateTime addRandomDeltaHours​(java.time.ZonedDateTime ZDT, int minHour, int maxHour)
      Adds/substract randomly between min/maxHours number of hours to this date, and a randomly selected minute between 0 and 60.
      static java.time.ZonedDateTime addRandomDeltaMinutes​(java.time.ZonedDateTime ZDT, int minMinutes, int maxMinutes)
      Adds/substract randomly between min/maxMinutes number of minutes to this date.
      static int computeAgeNow​(java.time.ZonedDateTime BirthDate)  
      static int computeAgeWhen​(java.time.ZonedDateTime BirthDate, java.time.ZonedDateTime When)  
      static int computeDays​(java.time.ZonedDateTime Start, java.time.ZonedDateTime End)
      Compute the number of days using the midnight rule, i.e., from 23:59 Monday night to 00:01 Tuesday morning, that counts as one day.
      static int computeDaysToNow​(java.time.ZonedDateTime Start)  
      static int daysBetween​(java.time.LocalDate Start, java.time.LocalDate End, boolean midnight)
      Compute the number of days, with or without the midnight rule, between two dates.
      static java.lang.String getCurrentZoneOffset()  
      static java.time.ZonedDateTime getIthDayTimestamp​(boolean Start, int i)
      Returns a ZonedDateTime for the very beginning of the ith day from today at 00:00:00:0000 or 23:59:59:999999999 depending on whether Start == true or false respectively.
      static java.time.ZonedDateTime getIthMonthTimestamp​(boolean Start, int i)  
      static java.time.ZonedDateTime getThisMonthTimestamp​(boolean Start)  
      static java.time.ZonedDateTime getTodayTimestamp​(boolean Start)
      Returns a ZonedDateTime for the very beginning of Today at 00:00:00:0000 if Start == true, or 23:59:59:999999999 is Start == false.
      static java.time.ZonedDateTime getTomorrowTimestamp​(boolean Start)
      Returns a ZonedDateTime for the very beginning of tomorrow at 00:00:00:0000 or 23:59:59:999999999 depending on whether Start == true or false respectively.
      static java.time.ZonedDateTime getYesterdayTimestamp​(boolean Start)
      Returns a ZonedDateTime for the very beginning of Yesterday at 00:00:00:0000 or 23:59:59:999999999 depending on whether Start == true or false respectively.
      static java.time.LocalDate greatest​(java.time.LocalDate d1, java.time.LocalDate d2)  
      static boolean isNowPlaceholder​(java.time.LocalDate D)  
      static boolean isNowPlaceholder​(java.time.ZonedDateTime ZDT)  
      static boolean isUndefinedPlaceholder​(java.time.LocalDate D)  
      static boolean isUndefinedPlaceholder​(java.time.ZonedDateTime ZDT)  
      static java.time.LocalDate least​(java.time.LocalDate d1, java.time.LocalDate d2)  
      static java.time.ZonedDateTime newTZ​(int Year, int Month, int Day, int Hour, int Minutes, int Seconds, int Milliseconds, java.time.ZoneId Z)
      Returns a new ZonedDateTime object based on the information provided using the ZonedDateTime class conventions.
      static java.time.ZonedDateTime newTZ​(int Year, int Month, int Day, int Hour, int Minutes, int Seconds, int Milliseconds, DateTimeZone Z)  
      static java.time.ZonedDateTime newUTC​(int Year, int Month, int Day, int Hour, int Minutes, int Seconds, int Milliseconds)
      Returns a new ZonedDateTime object in the UTC timezone, based on the information provided using the ZonedDateTime class conventions.
      static java.time.ZonedDateTime newUTC​(long epochMillis)
      Returns a new ZonedDateTime object in the UTC timezone, based on the information provided using the ZonedDateTime class conventions.
      static java.time.LocalDate newYMD​(int Year, int Month, int Day)  
      static java.time.ZonedDateTime nowLocal()  
      static java.time.LocalDate nowLocalDate()  
      static java.time.ZonedDateTime nowTZ​(java.time.ZoneId Z)  
      static java.time.ZonedDateTime nowTZ​(DateTimeZone Z)  
      static java.time.ZonedDateTime nowUTC()  
      static java.time.ZonedDateTime oldest​(java.time.ZonedDateTime ZDT1, java.time.ZonedDateTime ZDT2)  
      static java.time.ZonedDateTime paramToZDT​(java.lang.String param)
      Takes a string paramameter which can be either a date in the format yyyy-MM-dd or a positive integers denoting the number of days back from the current day.
      static java.time.ZonedDateTime parse​(java.lang.String DateTimeStr, java.lang.String Pattern)
      Simple method to get a ZonedDateTime object out of a string and a pattern
      static java.time.LocalDate parseDate​(java.lang.String dateStr)
      Simple method to get a LocalDate object out of a string for the default pattern 'yyyy-MM-dd'.
      static java.time.LocalDate parseDate​(java.lang.String dateStr, java.lang.String Pattern)
      Simple method to get a LocalDate object out of a string and a pattern.
      static java.time.LocalDate parseDateFromJSON​(java.lang.String DateStr)  
      static java.time.ZonedDateTime parsefromJSON​(java.lang.String DateTimeStr)
      Will parse an ISO string, even if partially done.
      static java.util.List<java.time.ZonedDateTime> parsefromJSON​(java.util.List<java.lang.String> DateTimeStr)  
      static java.sql.Timestamp parseToSqlTimestamp​(java.lang.String DateTimeStr, java.lang.String Pattern)  
      static java.time.ZonedDateTime parseWithoutZone​(java.lang.String DateTimeStr)
      Takes a zone-less timestamp and returns a ZonedDateTime based on the system zone.
      static java.lang.String preProcess​(java.lang.String Val, java.time.ZonedDateTime BaseTimeMarker)
      If the string passed in is not null and of exactly 16 characters in the form of "(+|-)(\d{2})y(\d{2})m(\d{2})d\s([01][0-9]|2[0-4])\:([0-5][0-9])", will return a JSON text representation of the baseTimeMarker with the delta specified by the pattern.
      static java.lang.String printDate​(java.time.LocalDate D)  
      static java.lang.String printDate​(java.time.LocalDate D, java.time.format.DateTimeFormatter formatter)  
      static java.lang.String printDate​(java.util.List<java.time.LocalDate> L)  
      static java.lang.String printDateForJSON​(java.time.LocalDate D)  
      static void printDateForSQL​(java.lang.StringBuilder str, java.time.LocalDate DT)  
      static void printDateForSQL​(java.lang.StringBuilder str, java.time.LocalDate DT, boolean printNull)  
      static java.lang.String printDateForSQL​(java.time.LocalDate DT)  
      static java.lang.String printDateForSQLQuoted​(java.time.LocalDate DT)  
      static java.lang.String printDateTime​(java.time.ZonedDateTime ZDT)  
      static java.lang.String printDateTime​(java.time.ZonedDateTime ZDT, java.lang.String Pattern)  
      static java.lang.String printDateTime​(java.util.List<java.time.ZonedDateTime> L)  
      static java.lang.String printDateTimeCompact​(java.time.ZonedDateTime ZDT, boolean PrintTime, boolean PrintSeconds)  
      static java.lang.String printDateTimeContextual​(java.time.ZonedDateTime ZDT, boolean PrintTime, boolean PrintSeconds)
      Compute a contextual date based on now.
      static java.lang.String printDateTimeForHTTP​(java.time.ZonedDateTime ZDT)  
      static java.lang.String printDateTimeForJSON​(java.time.ZonedDateTime ZDT)  
      static java.lang.String printDateTimeForJSON​(java.time.ZonedDateTime ZDT, boolean forceISOZDT)  
      static void printDateTimeForSQL​(java.lang.StringBuilder str, java.time.ZonedDateTime ZDT)  
      static void printDateTimeForSQL​(java.lang.StringBuilder str, java.time.ZonedDateTime ZDT, boolean printNull)  
      static java.lang.String printDateTimeForSQL​(java.time.ZonedDateTime ZDT)  
      static java.util.List<java.lang.String> printDateTimeForSQL​(java.util.List<java.time.ZonedDateTime> ZDTs)  
      static java.lang.String printDateTimeForSQLQuoted​(java.time.ZonedDateTime ZDT)  
      static java.lang.String printDateTimeFriendly​(java.time.ZonedDateTime ZDT, boolean PrintTime, boolean PrintSeconds)  
      static java.lang.String printDateTimeSuperCompact​(java.time.ZonedDateTime ZDT)  
      static java.lang.String printTime24​(java.time.ZonedDateTime ZDT)  
      static java.time.LocalDate toLocalDate​(java.sql.Date D)  
      static java.util.List<java.time.LocalDate> toLocalDates​(java.util.List<java.sql.Date> D)  
      static java.util.Set<java.time.LocalDate> toLocalDates​(java.util.Set<java.sql.Date> D)  
      static java.util.List<java.sql.Timestamp> toSQLTimeStamps​(java.util.List<java.time.ZonedDateTime> L)  
      static java.time.ZonedDateTime toZonedDateTime​(java.sql.Timestamp T, java.lang.String ZoneStr)
      Expects a TimeStanmp object directly form the database, typically in local time, and converts it to the right date and time in the supplied timezone ZoneStr.
      static java.time.ZonedDateTime toZonedDateTime​(java.time.LocalDate dt, java.lang.String zoneStr)  
      static java.util.List<java.time.ZonedDateTime> toZonedDateTimes​(java.util.List<java.sql.Timestamp> D, java.lang.String zoneStr)  
      static java.util.List<java.time.ZonedDateTime> toZonedDateTimes​(java.util.List<java.time.LocalDate> D, java.util.List<java.lang.String> zoneStr)  
      static java.time.LocalDate truncateTo​(java.time.LocalDate LD, TimeSeriesType t)  
      static java.time.ZonedDateTime truncateTo​(java.time.ZonedDateTime ZDT, TimeSeriesType t)  
      static java.util.Iterator<java.time.LocalDate> truncateToLD​(java.util.Iterator<java.time.LocalDate> I, TimeSeriesType tst)  
      static java.time.LocalDate[] truncateToZDT​(java.time.LocalDate[] A, TimeSeriesType tst)  
      static java.time.ZonedDateTime[] truncateToZDT​(java.time.ZonedDateTime[] A, TimeSeriesType tst)  
      static java.util.Iterator<java.time.ZonedDateTime> truncateToZDT​(java.util.Iterator<java.time.ZonedDateTime> I, TimeSeriesType tst)  
      static boolean validateBoundary​(TimeSeriesType Type, boolean Start, java.time.ZonedDateTime ZDT)  
      static java.time.ZonedDateTime youngest​(java.time.ZonedDateTime ZDT1, java.time.ZonedDateTime ZDT2)  
      • Methods inherited from class java.lang.Object

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

      • LOG

        protected static final org.apache.logging.log4j.Logger LOG
      • _UTC

        public static final java.time.ZoneId _UTC
      • _LOCAL

        public static final java.time.ZoneId _LOCAL
      • NOW_PLACEHOLDER_ZDT

        public static final java.time.ZonedDateTime NOW_PLACEHOLDER_ZDT
      • NOW_PLACEHOLDER_D

        public static final java.time.LocalDate NOW_PLACEHOLDER_D
      • UNDEFINED_PLACEHOLDER_ZDT

        public static final java.time.ZonedDateTime UNDEFINED_PLACEHOLDER_ZDT
      • UNDEFINED_PLACEHOLDER_D

        public static final java.time.LocalDate UNDEFINED_PLACEHOLDER_D
      • _UTC_CALENDAR

        public static final java.util.Calendar _UTC_CALENDAR
      • _LOCAL_CALENDAR

        public static final java.util.Calendar _LOCAL_CALENDAR
    • Constructor Detail

      • DateTimeUtil

        public DateTimeUtil()
    • Method Detail

      • isNowPlaceholder

        public static boolean isNowPlaceholder​(java.time.ZonedDateTime ZDT)
      • isNowPlaceholder

        public static boolean isNowPlaceholder​(java.time.LocalDate D)
      • isUndefinedPlaceholder

        public static boolean isUndefinedPlaceholder​(java.time.ZonedDateTime ZDT)
      • isUndefinedPlaceholder

        public static boolean isUndefinedPlaceholder​(java.time.LocalDate D)
      • newUTC

        public static java.time.ZonedDateTime newUTC​(int Year,
                                                     int Month,
                                                     int Day,
                                                     int Hour,
                                                     int Minutes,
                                                     int Seconds,
                                                     int Milliseconds)
        Returns a new ZonedDateTime object in the UTC timezone, based on the information provided using the ZonedDateTime class conventions.
      • newUTC

        public static java.time.ZonedDateTime newUTC​(long epochMillis)
        Returns a new ZonedDateTime object in the UTC timezone, based on the information provided using the ZonedDateTime class conventions.
      • newTZ

        public static java.time.ZonedDateTime newTZ​(int Year,
                                                    int Month,
                                                    int Day,
                                                    int Hour,
                                                    int Minutes,
                                                    int Seconds,
                                                    int Milliseconds,
                                                    java.time.ZoneId Z)
        Returns a new ZonedDateTime object based on the information provided using the ZonedDateTime class conventions.
      • newTZ

        public static java.time.ZonedDateTime newTZ​(int Year,
                                                    int Month,
                                                    int Day,
                                                    int Hour,
                                                    int Minutes,
                                                    int Seconds,
                                                    int Milliseconds,
                                                    DateTimeZone Z)
      • newYMD

        public static java.time.LocalDate newYMD​(int Year,
                                                 int Month,
                                                 int Day)
      • getCurrentZoneOffset

        public static java.lang.String getCurrentZoneOffset()
      • nowLocal

        public static java.time.ZonedDateTime nowLocal()
      • nowUTC

        public static java.time.ZonedDateTime nowUTC()
      • nowTZ

        public static java.time.ZonedDateTime nowTZ​(java.time.ZoneId Z)
      • nowTZ

        public static java.time.ZonedDateTime nowTZ​(DateTimeZone Z)
      • nowLocalDate

        public static java.time.LocalDate nowLocalDate()
      • oldest

        public static java.time.ZonedDateTime oldest​(java.time.ZonedDateTime ZDT1,
                                                     java.time.ZonedDateTime ZDT2)
      • youngest

        public static java.time.ZonedDateTime youngest​(java.time.ZonedDateTime ZDT1,
                                                       java.time.ZonedDateTime ZDT2)
      • printDateTimeForHTTP

        public static java.lang.String printDateTimeForHTTP​(java.time.ZonedDateTime ZDT)
      • parse

        public static java.time.ZonedDateTime parse​(java.lang.String DateTimeStr,
                                                    java.lang.String Pattern)
        Simple method to get a ZonedDateTime object out of a string and a pattern
      • parseDate

        public static java.time.LocalDate parseDate​(java.lang.String dateStr,
                                                    java.lang.String Pattern)
        Simple method to get a LocalDate object out of a string and a pattern.

        This method returns a LocalDate based on a string value and a standard pattern. It avoids throwing an exception if the data cannot be parsed and will return NULL instead with a warning in the logs.

        Returns:
        a LocalDate object if the string could be parsed, or null otherwise.
      • parseDate

        public static java.time.LocalDate parseDate​(java.lang.String dateStr)
        Simple method to get a LocalDate object out of a string for the default pattern 'yyyy-MM-dd'.

        This method returns a LocalDate based on a string value and a standard pattern. It avoids throwing an exception if the data cannot be parsed and will return NULL instead with a warning in the logs.

        Returns:
        a LocalDate object if the string could be parsed, or null otherwise.
      • parseToSqlTimestamp

        public static java.sql.Timestamp parseToSqlTimestamp​(java.lang.String DateTimeStr,
                                                             java.lang.String Pattern)
      • printDateTime

        public static java.lang.String printDateTime​(java.time.ZonedDateTime ZDT,
                                                     java.lang.String Pattern)
      • printDateTime

        public static java.lang.String printDateTime​(java.time.ZonedDateTime ZDT)
      • printDateTime

        public static java.lang.String printDateTime​(java.util.List<java.time.ZonedDateTime> L)
      • printDateTimeForSQL

        public static void printDateTimeForSQL​(java.lang.StringBuilder str,
                                               java.time.ZonedDateTime ZDT,
                                               boolean printNull)
      • printDateTimeForSQL

        public static void printDateTimeForSQL​(java.lang.StringBuilder str,
                                               java.time.ZonedDateTime ZDT)
      • printDateTimeForSQL

        public static java.lang.String printDateTimeForSQL​(java.time.ZonedDateTime ZDT)
      • printDateTimeForSQLQuoted

        public static java.lang.String printDateTimeForSQLQuoted​(java.time.ZonedDateTime ZDT)
      • printDateForSQL

        public static void printDateForSQL​(java.lang.StringBuilder str,
                                           java.time.LocalDate DT,
                                           boolean printNull)
      • printDateForSQL

        public static void printDateForSQL​(java.lang.StringBuilder str,
                                           java.time.LocalDate DT)
      • printDateForSQL

        public static java.lang.String printDateForSQL​(java.time.LocalDate DT)
      • printDateForSQLQuoted

        public static java.lang.String printDateForSQLQuoted​(java.time.LocalDate DT)
      • printDateTimeForSQL

        public static java.util.List<java.lang.String> printDateTimeForSQL​(java.util.List<java.time.ZonedDateTime> ZDTs)
      • printDateTimeForJSON

        public static java.lang.String printDateTimeForJSON​(java.time.ZonedDateTime ZDT)
      • printDateTimeForJSON

        public static java.lang.String printDateTimeForJSON​(java.time.ZonedDateTime ZDT,
                                                            boolean forceISOZDT)
      • printDate

        public static java.lang.String printDate​(java.time.LocalDate D)
      • printDate

        public static java.lang.String printDate​(java.time.LocalDate D,
                                                 java.time.format.DateTimeFormatter formatter)
      • printDateForJSON

        public static java.lang.String printDateForJSON​(java.time.LocalDate D)
      • printDate

        public static java.lang.String printDate​(java.util.List<java.time.LocalDate> L)
      • parsefromJSON

        public static java.time.ZonedDateTime parsefromJSON​(java.lang.String DateTimeStr)
        Will parse an ISO string, even if partially done. It will auto-complete as per parseWithoutZone(String).
        • yyyy-dd-mm -> yyy-mm-ddT00:00:00+04:00 (for EDT timezone)
        • yyyy-dd-mmThh:mm -> yyy-mm-ddThh:mm:00+04:00
        • yyyy-dd-mmThh:mm -> yyy-mm-ddThh:mm:00+04:00
        • yyyy-dd-mmThh:mm:ss -> yyy-mm-ddThh:mm:ss+04:00
        • yyyy-dd-mmThh:mm:ss+hh:mm -> yyy-mm-ddThh:mm:ss+hh:mm
        Parameters:
        DateTimeStr -
        Returns:
        a ZonedDateTime object, or null if an error occurred (doesn't throw but will log exception if one occurred)
      • parsefromJSON

        public static java.util.List<java.time.ZonedDateTime> parsefromJSON​(java.util.List<java.lang.String> DateTimeStr)
      • parseDateFromJSON

        public static java.time.LocalDate parseDateFromJSON​(java.lang.String DateStr)
      • parseWithoutZone

        public static java.time.ZonedDateTime parseWithoutZone​(java.lang.String DateTimeStr)
        Takes a zone-less timestamp and returns a ZonedDateTime based on the system zone. It will auto-complete with 0's if hours, minutes and/or seconds are missing and use the appropriate offset as per the system ZoneId.
        • yyyy-dd-mm -> yyy-mm-dd 00:00:00
        • yyyy-dd-mm hh:mm -> yyy-mm-dd hh:mm:00
        • yyyy-dd-mm hh:mm:ss -> yyy-mm-dd hh:mm:ss
        Parameters:
        DateTimeStr -
        Returns:
        a ZonedDateTime object, or null if an error occurred (doesn't throw but will log exception if one occurred)
      • printDateTimeFriendly

        public static java.lang.String printDateTimeFriendly​(java.time.ZonedDateTime ZDT,
                                                             boolean PrintTime,
                                                             boolean PrintSeconds)
      • printDateTimeCompact

        public static java.lang.String printDateTimeCompact​(java.time.ZonedDateTime ZDT,
                                                            boolean PrintTime,
                                                            boolean PrintSeconds)
      • printDateTimeSuperCompact

        public static java.lang.String printDateTimeSuperCompact​(java.time.ZonedDateTime ZDT)
      • printTime24

        public static java.lang.String printTime24​(java.time.ZonedDateTime ZDT)
      • printDateTimeContextual

        public static java.lang.String printDateTimeContextual​(java.time.ZonedDateTime ZDT,
                                                               boolean PrintTime,
                                                               boolean PrintSeconds)
        Compute a contextual date based on now. For example, if the date passed is from today, will print only "10:54am today". If yesterday, will print "4:24pm yesterday". If within a week, will print "last/this Monday 1:30pm". If the date is older, will simply print "March 23" or "March 23, 12:30pm" if AlwaysPrintTime is true.
        This method is not localized.
        Parameters:
        ZDT - The date whose value to print
        AlwaysPrintTime - Whether Time should be printed for "beyond the week" dates
        Returns:
        a stringwith the printed date.
      • toZonedDateTime

        public static java.time.ZonedDateTime toZonedDateTime​(java.sql.Timestamp T,
                                                              java.lang.String ZoneStr)
        Expects a TimeStanmp object directly form the database, typically in local time, and converts it to the right date and time in the supplied timezone ZoneStr. If ZoneStr is null of invalid, the returned Zon3dDateTime will be in UTC.
        Parameters:
        T -
        ZoneStr -
        Returns:
      • toZonedDateTime

        public static java.time.ZonedDateTime toZonedDateTime​(java.time.LocalDate dt,
                                                              java.lang.String zoneStr)
      • toZonedDateTimes

        public static java.util.List<java.time.ZonedDateTime> toZonedDateTimes​(java.util.List<java.sql.Timestamp> D,
                                                                               java.lang.String zoneStr)
      • toZonedDateTimes

        public static java.util.List<java.time.ZonedDateTime> toZonedDateTimes​(java.util.List<java.time.LocalDate> D,
                                                                               java.util.List<java.lang.String> zoneStr)
      • toLocalDate

        public static java.time.LocalDate toLocalDate​(java.sql.Date D)
      • toLocalDates

        public static java.util.List<java.time.LocalDate> toLocalDates​(java.util.List<java.sql.Date> D)
      • toLocalDates

        public static java.util.Set<java.time.LocalDate> toLocalDates​(java.util.Set<java.sql.Date> D)
      • addRandomDeltaDays

        public static java.time.ZonedDateTime addRandomDeltaDays​(java.time.ZonedDateTime ZDT,
                                                                 int minDays,
                                                                 int maxDays,
                                                                 int minHour,
                                                                 int maxHour)
        Adds/substract randomly between minDays and maxDays number of days to this date and sets the hours within the range prescribed (min/maxHours), and a randomly selected minute between 0 and 60.
      • addRandomDeltaHours

        public static java.time.ZonedDateTime addRandomDeltaHours​(java.time.ZonedDateTime ZDT,
                                                                  int minHour,
                                                                  int maxHour)
        Adds/substract randomly between min/maxHours number of hours to this date, and a randomly selected minute between 0 and 60.
      • addRandomDeltaMinutes

        public static java.time.ZonedDateTime addRandomDeltaMinutes​(java.time.ZonedDateTime ZDT,
                                                                    int minMinutes,
                                                                    int maxMinutes)
        Adds/substract randomly between min/maxMinutes number of minutes to this date.
      • computeAgeNow

        public static int computeAgeNow​(java.time.ZonedDateTime BirthDate)
      • computeAgeWhen

        public static int computeAgeWhen​(java.time.ZonedDateTime BirthDate,
                                         java.time.ZonedDateTime When)
      • computeDaysToNow

        public static int computeDaysToNow​(java.time.ZonedDateTime Start)
      • computeDays

        public static int computeDays​(java.time.ZonedDateTime Start,
                                      java.time.ZonedDateTime End)
        Compute the number of days using the midnight rule, i.e., from 23:59 Monday night to 00:01 Tuesday morning, that counts as one day.
        Parameters:
        Start -
        End -
        Returns:
      • daysBetween

        public static int daysBetween​(java.time.LocalDate Start,
                                      java.time.LocalDate End,
                                      boolean midnight)
        Compute the number of days, with or without the midnight rule, between two dates. The midnight rule implies that midnight needs to be crossed to count as 1 day. So, if the two dates are identical (same day), then with midnight==true is 0 whereas with midnight==false, it's 1.
        Parameters:
        Start -
        End -
        Returns:
        -1 if either of the dates are null or if start > end
      • getTodayTimestamp

        public static java.time.ZonedDateTime getTodayTimestamp​(boolean Start)
        Returns a ZonedDateTime for the very beginning of Today at 00:00:00:0000 if Start == true, or 23:59:59:999999999 is Start == false.
        Returns:
      • getYesterdayTimestamp

        public static java.time.ZonedDateTime getYesterdayTimestamp​(boolean Start)
        Returns a ZonedDateTime for the very beginning of Yesterday at 00:00:00:0000 or 23:59:59:999999999 depending on whether Start == true or false respectively.
        Returns:
      • getTomorrowTimestamp

        public static java.time.ZonedDateTime getTomorrowTimestamp​(boolean Start)
        Returns a ZonedDateTime for the very beginning of tomorrow at 00:00:00:0000 or 23:59:59:999999999 depending on whether Start == true or false respectively.
        Returns:
      • getIthDayTimestamp

        public static java.time.ZonedDateTime getIthDayTimestamp​(boolean Start,
                                                                 int i)
        Returns a ZonedDateTime for the very beginning of the ith day from today at 00:00:00:0000 or 23:59:59:999999999 depending on whether Start == true or false respectively. +1 for example gives tomorrow, while -1 gets yesterday.
        Returns:
      • getThisMonthTimestamp

        public static java.time.ZonedDateTime getThisMonthTimestamp​(boolean Start)
      • getIthMonthTimestamp

        public static java.time.ZonedDateTime getIthMonthTimestamp​(boolean Start,
                                                                   int i)
      • preProcess

        public static java.lang.String preProcess​(java.lang.String Val,
                                                  java.time.ZonedDateTime BaseTimeMarker)
        If the string passed in is not null and of exactly 16 characters in the form of "(+|-)(\d{2})y(\d{2})m(\d{2})d\s([01][0-9]|2[0-4])\:([0-5][0-9])", will return a JSON text representation of the baseTimeMarker with the delta specified by the pattern. For example if the date time passed is 2015-02-10 (irrespective of the time specified)
        • "-01y00m05d 10:50" -> 2014-02-05 10:50:00
        • "+00y00m04d 14:50" -> 2015-02-14 14:50:00
        Parameters:
        Val -
        baseTimeMarker -
        Returns:
      • validateBoundary

        public static boolean validateBoundary​(TimeSeriesType Type,
                                               boolean Start,
                                               java.time.ZonedDateTime ZDT)
      • toSQLTimeStamps

        public static java.util.List<java.sql.Timestamp> toSQLTimeStamps​(java.util.List<java.time.ZonedDateTime> L)
      • least

        public static java.time.LocalDate least​(java.time.LocalDate d1,
                                                java.time.LocalDate d2)
      • greatest

        public static java.time.LocalDate greatest​(java.time.LocalDate d1,
                                                   java.time.LocalDate d2)
      • paramToZDT

        public static java.time.ZonedDateTime paramToZDT​(java.lang.String param)
        Takes a string paramameter which can be either a date in the format yyyy-MM-dd or a positive integers denoting the number of days back from the current day. If yyyy-MM-dd, returns a ZDT for 00:00:00 on that day for the current timezone. If an integer, will returns a ZDT for 00:00:00 on that prior day.
        Parameters:
        param -
        Returns:
      • truncateTo

        public static java.time.LocalDate truncateTo​(java.time.LocalDate LD,
                                                     TimeSeriesType t)
      • truncateTo

        public static java.time.ZonedDateTime truncateTo​(java.time.ZonedDateTime ZDT,
                                                         TimeSeriesType t)
      • truncateToZDT

        public static java.util.Iterator<java.time.ZonedDateTime> truncateToZDT​(java.util.Iterator<java.time.ZonedDateTime> I,
                                                                                TimeSeriesType tst)
      • truncateToZDT

        public static java.time.ZonedDateTime[] truncateToZDT​(java.time.ZonedDateTime[] A,
                                                              TimeSeriesType tst)
      • truncateToLD

        public static java.util.Iterator<java.time.LocalDate> truncateToLD​(java.util.Iterator<java.time.LocalDate> I,
                                                                           TimeSeriesType tst)
      • truncateToZDT

        public static java.time.LocalDate[] truncateToZDT​(java.time.LocalDate[] A,
                                                          TimeSeriesType tst)