company logo

DateTime :: addMonths - Add months to date value

The function adds a number of months to the current date and returns the new timestamp value.

Return value:  Time stamp ( odaba::DateTime & )

A time stamp combines date and time

Implementation details

odaba::DateTime & DateTime  :: addMonths ( int32 iMonths )

The number of months passed in iMonths is added to the date value. Year may change, when month exceeds 12. Usually, day remains unchanged, but will be adjusted, when the new month value does not have the resulting day

  DateTime      timestamp(Date(31,1,2009),Time(12,0,0));

  date.addMonths(1); // day becomes: 2009-28-2

  • iMonths - Months

    Time span in months.