Exemple #1
0
  // initFromYearMonthDay
  void Date::initFromYearMonthDay(int year, MonthOfYear monthOfYear, unsigned dayOfMonth)
  {
    try{
      // construct with year, month, day
      m_impl = ImplPtr(new ImplType(year, monthOfYear.value(), dayOfMonth));
    }catch(...){
    }

    if (!m_impl || m_impl->is_not_a_date()){
      LOG_AND_THROW("Bad Date: year = " << year << ", month = " << monthOfYear << 
          ", day = " << dayOfMonth << ". ");
    }
  }
Exemple #2
0
  // initFromYearMonthDay
  void Date::initFromYearMonthDay(int year, MonthOfYear monthOfYear, unsigned dayOfMonth)
  {
    bool initialized = false;
    try{
      // construct with year, month, day
      m_impl = ImplType(year, monthOfYear.value(), dayOfMonth);
      initialized = true;
    }catch(...){
    }

    if (!initialized || m_impl.is_not_a_date()){
      LOG_AND_THROW("Bad Date: year = " << year << ", month = " << monthOfYear << 
          ", day = " << dayOfMonth << ". ");
    }
  }
Exemple #3
0
 /// convert MonthOfYear to unsigned
 unsigned month(MonthOfYear monthOfYear)
 {
   return monthOfYear.value() + (1 - MonthOfYear::Jan);
 }
Exemple #4
0
 Date Date::fromNthDayOfMonth(NthDayOfWeekInMonth n, DayOfWeek dayOfWeek, MonthOfYear monthOfYear, int year)
 {
   nth_day_of_the_week_in_month ndm(static_cast<nth_day_of_the_week_in_month::week_num>(n.value()), dayOfWeek.value(), monthOfYear.value());
   date d = ndm.get_date(year);
   return Date(d.month().as_enum(), d.day(), d.year());
 }