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:
|
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 |
รายละเอียดทางเทคนิค
ทำงานใน: | จากการเข้าถึง 2000 |
---|
ตัวอย่างเพิ่มเติม
ตัวอย่าง
เพิ่มหนึ่งปีในวันที่ระบบปัจจุบัน:
SELECT DateAdd("yyyy", 1, Date());
ตัวอย่าง
เพิ่ม 6 เดือนจากวันเกิดของพนักงาน:
SELECT LastName, DateAdd("m", 6, BirthDate) FROM Employees;