# 22. Virtuoso Functions Guide - dateadd

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
datestring, ...
curdate
dateadd
datediff
datestring_gmt
dayname
dayofmonth
dayofweek
dayofyear
dt_set_tz
get_timestamp
getdate
hour
minute
month
monthname
msec_time
now
quarter
second
stringdate
stringtime
timezone
week
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## dateadd

arithmetic add to a date
dateadd (in unit string, in number integer, in date datetime);
Parameters
unit – String value denoting the unit to use in the addition.
number – Integer number of unit units to be added.
date – Datetime value to which the number of units is to be added
Description

dateadd adds a positive or negative quantity of units to a date (in the internal date time format), and returns a new date so formed. The unit is specified as a string and can be one of the following: 'second', 'minute', 'hour', 'day', 'month', or 'year'. Use datestring to convert the result to a human-readable string.

Examples
Simple date addition

Add 10 days to 1996.10.10.

    SQL> select dateadd ('day', 10, stringdate ('1996.10.10'));
    callret
    BINARY
    _______________________________________________________________________________

    1996-10-20 01:00:00

    1 Rows. -- 92 msec.

See Also

datediff, datestring, stringdate