DateAdd: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "DATEADD(''interval'',''number'',''date'') '''Description''' DATEADD returns the date which is obtained by adding a specified number of date intervals to a given date. The re...")
 
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
DATEADD(''interval'',''number'',''date'')
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.''  


'''Description'''
DateAdd(''interval'',''number'',''date'')


DATEADD returns the date which is obtained by adding a specified number of date intervals to a given date. The required parameter, interval, is a string expression that specifies the type of date interval to add, see Table 6 below. The required parameter, number, is any numeric expression that specifies the number of intervals to add.The required parameter, date, can be any expression that represents a date.
== Description ==


'''Table 6: Interval Values'''
DateAdd returns the date which is obtained by adding a specified number of date intervals to a given date. The required parameter, interval, is a string expression that specifies the type of date interval to add: see table below. The required parameter, ''number'', is any numeric expression that specifies the number of intervals to add.The required parameter, ''date'', can be any expression that represents a date.
 
'''Interval Values'''


{| class="wikitable"
{| class="wikitable"
Line 32: Line 34:
|}
|}


'''Example'''
== Example (Basic) ==


<pre>
<pre>
REM DATEADD Example
Rem DateAdd Example
'DATEADD adds date intervals to a date
'DateAdd adds date intervals to a date
PRINT "+10 seconds:", DATEADD("s", 10, NOW)
Print "+10 seconds:", DateAdd("s", 10, NOW)
PRINT "-1 year:", DATEADD("yyyy", -1, NOW)
Print "-1 year:", DateAdd("yyyy", -1, NOW)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 48: Line 50:
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[datediff|DateDiff]], [[datepart|DatePart]]
 
[[Category:Language Reference]]
 
[[Category:Date and Time]]


[[datediff|DATEDIFF]], [[datepart|DATEPART]]
[[Category:BASIC Functions]]

Latest revision as of 15:21, 25 March 2019

This function is for BASIC compatibility. It is not available in pure JavaScript projects.

DateAdd(interval,number,date)

Description

DateAdd returns the date which is obtained by adding a specified number of date intervals to a given date. The required parameter, interval, is a string expression that specifies the type of date interval to add: see table below. The required parameter, number, is any numeric expression that specifies the number of intervals to add.The required parameter, date, can be any expression that represents a date.

Interval Values

Value Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week of year
h Hour
n Minute
s Second

Example (Basic)

Rem DateAdd Example
'DateAdd adds date intervals to a date
Print "+10 seconds:", DateAdd("s", 10, NOW)
Print "-1 year:", DateAdd("yyyy", -1, NOW)

Output

+10 seconds:  8/18/98 10:52:54 PM
-1 year:      8/18/97 10:52:44 PM

Related Items

DateDiff, DatePart