- Contents
Interaction Designer Help
Changing Datetime Values
The following operators can be used to change an existing datetime value.
AddYears
AddYears(dt, years)
Adds the specified number of years to the datetime value (dt). For example, adding 1 year to January 10, 2003 would result in January 10, 2004.
Note: Each year added does not add 365 days to dt. Instead, each year added adds one to the year portion of that variable. This is done to avoid any problems that may occur by adding through a leap year (e.g., January 4, 2004 to January 4, 2005 is 366 days, not 365). If a non-existent date results, such as by adding one year to February 29, 2004, the resulting dt is normalized to the closest matching real date (i.e., February 28, 2005).
AddMonths
AddMonths(dt, months)
Adds the specified number of months to the datetime value (dt). Note that this is not a fixed number of thirty days, because not all months are thirty days in length. One month added to January 6 would become February 6, and one month added to February 6 would become March 6, even though January is 31 days in length and February is 28. Also, non-existent dates are "normalized" to the closest matching real date; adding one month to January 31 would result in February 28 (or February 29 if it’s a leap year), and adding five months to January 31 would result in June 30.
AddDays
AddDays(dt, days)
Adds 86,400 seconds times the number specified in "days" to the datetime (dt). For example, AddDays (dt, 4) would add 345,600 seconds to dt.
AddHours
AddHours(dt, hrs)
Adds 3600 seconds times the number specified in "hrs" to the datetime (dt). For example, AddHours (dt, 4) would add 14,400 seconds to dt.
AddMinutes
AddMinutes(dt, mins)
Adds 60 seconds times the number specified in "mins" to the datetime (dt). For example, AddMinutes (dt, 4) would add 240 seconds to dt.
AddSeconds
AddSeconds(dt, secs)
Adds the number of seconds specified in secs to the datetime (dt).