目录

MS Access DateAdd() 函数

示例

将两年添加到指定日期:

SELECT DateAdd("yyyy", 2, #22/11/2017#);
亲自试一试 »

定义和用法

DateAdd() 函数将时间/日期间隔添加到日期,然后返回日期。

语法

DateAdd( interval, number, date)

参数值

Parameter Description
interval Required. The time/date interval to add. Can be one of the following values:
  • yyyy = Year
  • q = Quarter
  • m = month
  • y = Day of the year
  • d = Day
  • w = Weekday
  • ww = Week
  • h = hour
  • n = Minute
  • s = Second
number Required. The number of interval to add to date. Can be positive (to get dates in the future) or negative (to get dates in the past)
date Required. The date to which the interval should be added

技术细节

工作于: 从 Access 2000

更多示例

示例

在当前系统日期上加一年:

SELECT DateAdd("yyyy", 1, Date());
亲自试一试 »

示例

在员工的出生日期上加上 6 个月:

SELECT LastName, DateAdd("m", 6, BirthDate) FROM Employees;
亲自试一试 »