Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note that months are an abstract concept, so adding months is also done abstractly. If the current month is February 28, and you add 1 whole month, you will get March 28. In other words, whole months are added without altering the day of the month, unless the day would be invalid. As an example, If you add 1 whole month to January 31, you'll get February 28. Fractions of a month are calculated using the average month length, which is 30.4375. For example, if you add 1.5 months to February 28, you'll get April 12th, which is 15 days (half of 30.4375) after March 28th.

Note also that this method never alters the time of day.

Examples

Code Block
languagebp
// Add 10 months to the current datetime
NewDateTime = SRP_DateTime("AddMonths", DateTime(), 10)

// Add a month and a half to the current datetime
NewDateTime = SRP_DateTime("AddMonths", DateTime(), 1.5)

// Subtract 10 months from the current datetime
NewDateTime = SRP_DateTime("AddMonths", DateTime(), -10)

...