DateAdd
Adds offset intervals to a date/time value and returns the new date/time. Use a negative offset to subtract. Interval names are not case-sensitive.
String DateAdd(String dateTime, String interval, Numeric offset)
| Interval | Aliases |
| Year | yy, yyyy |
| Quarter | qq, q |
| Month | mm, m |
| Week | ww, wk |
| Weekday | dw (Monday to Friday) |
| Day | dy |
| DayOfYear | |
| Hour | hh |
| Minute | mi |
| Second | s |
| Millisecond | ms |
Result format
The result uses the server's default date/time format, which depends on its culture settings. Wrap DateAdd in FormatDateTime for a predictable format.SELECT FormatDateTime(DateAdd('2024-01-31', 'Month', 1), 'yyyy-MM-dd') as Result FROM SingleSELECT FormatDateTime(DateAdd(DateTimeUTC(), 'Day', -10), 'yyyy/MM/dd hh:mm:ss tt') as Result FROM SingleSQL :: IsNotLike
Returns true (1) if the text does not match the pattern. See Like for the wildcards.
SQL :: IsNull
Returns true (1) if the given value is null, otherwise false (0). This is how to test for missing fields and for the unmatched side of an outer join.
SQL :: IsNumeric
Returns true (1) if the given value is a number: digits with an optional leading sign and an optional decimal point. Null and empty values return 0.
SQL :: IsString
Returns true (1) if the given value cannot be converted to a number.
SQL :: LastIndexOf
Returns the zero-based position of the last occurrence of textToFind in textToSearch. Returns -1 when it is not found.
SQL :: Left
Returns the given number of characters from the start of the value.
SQL :: Length
Returns the number of characters in the given value.
SQL :: NullIf
Returns null when the conditional is true, otherwise returns the value.
SQL :: NullIfNumeric
Returns null when the conditional is true, otherwise returns the number.
SQL :: NullWhen
Returns null when the value equals compareToValue, otherwise returns the value.