Interface ICalendarFactory

  • All Known Implementing Classes:
    CalendarFactoryImpl

    public interface ICalendarFactory

    ICalendarFactory interface.

    This class parses phrases that will be used to compute a date. That date will be returned as a Calendar.

    The first token can be a special date function that is relative to the current date.

    • Today or Now
    • specific date in a format that is supported by the Date argument.

    The following parameters are applied in order to that date. Each one has this structure. No spaces are allowed within a parameter.

    1. + or - or @: the direction of effect on the date (@ means absolute or at)
    2. > or < or >= or <=: next, prev, next or this, prev or this.
    3. ### : the quantity of the effect; E and B can be used in conjunction with the direction
    4. unit : the unit of the effect (case is not important)
      • (T)ime (@BTime and @ETime are valid giving 0:0:0.0 and 23:59:59.999 respectively)
      • (Y)ear
      • (M)onth
      • (W)eekOfYear (B and E work on the current week)
      • Week(O)fMonth (B and E work on the current week)
      • (D)ay
      • D(a)yOfWeek (B and E work on the current week, @ is current week, - is previous week, and + is next week. Sunday is the first day of the week.)
      • (H)our
      • M(i)nute
      • (S)econd
      • Mi(l)lisecond or ms

    examples

    The beginning of today

    _dateTime(now @bday)

    The beginning of yesterday

    _dateTime(now -1day @bday)

    The end of yesterday

    _dateTime(now -1day @eday)

    Monday of this week

    _dateTime(now @2dayOfWeek)

    Monday of the week that contained 2010/04/09

    _dateTime(2010/04/09 @2dayOfWeek)

    Same day and time last week

    _dateTime(now -1week)

    Same day last week but at the end of that day.

    _dateTime(now -1week @eday)

    The first day of this month

    _dateTime(now @1d)

    The last day of last month

    _dateTime(now -1month @emonth)
    This could be done in different ways (like all of the others too),
    _dateTime(now @1d -1d @ed)
    Author:
    Chris DeGreef [email protected]