Class TimeInstant


  • public class TimeInstant
    extends Object
    This class is used to represent a given time instant relative to the current time.

    Some examples of time instants are:

    • now
    • now -10second or just -10second
    • begin[minute] => begin of current minute. It turns back the clock to first second.
    • begin[year March] => begin of current year (year starting on March)
    • end[year March] +1year => end of next year (year starting on March)
    • begin[year March] -7day => last year's last week start

    • Field Detail

      • START_TIME

        public static Date START_TIME
    • Method Detail

      • setIntervalType

        public void setIntervalType​(DateIntervalType intervalType)
      • getFirstMonthOfYear

        public Month getFirstMonthOfYear()
      • setFirstMonthOfYear

        public void setFirstMonthOfYear​(Month firstMonthOfYear)
      • getTimeAmount

        public TimeAmount getTimeAmount()
      • setTimeAmount

        public void setTimeAmount​(TimeAmount timeAmount)
      • getTimeInstant

        public Date getTimeInstant()
      • setStartTime

        public void setStartTime​(Date now)
      • getStartTime

        public Date getStartTime()
      • calculateStartTime

        protected Date calculateStartTime()
      • now

        public static TimeInstant now()
        Return a time instant representing the current time.
      • parse

        public static TimeInstant parse​(String timeInstantExpr)
        Parses a time instant expression.
        Parameters:
        timeInstantExpr - A valid time instant expression (see TimeInstant class javadoc)
        Returns:
        A TimeInstant instance
        Throws:
        IllegalArgumentException - If the expression is not valid