MS Access DateDiff ()ฟังก์ชัน
ตัวอย่าง
ส่งกลับความแตกต่างระหว่างวันที่สองวันในปี:
SELECT DateDiff("yyyy", #13/01/1998#, #09/05/2017#);
ความหมายและการใช้งาน
ฟังก์ชัน DateDiff() จะคืนค่าส่วนต่างระหว่างวันที่สองวัน
ไวยากรณ์
DateDiff(datepart, date1, date2, firstdayofweek,
firstweekofyear)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
datepart | Required. The part to return. Can be one of the following values:
|
date1 and date2 | Required. The two dates to calculate the difference between |
firstdayofweek | Optional. Specifies the first day of the week.
Can be one of the following values:
|
firstdayofyear | Optional. Specifies the first week of the year. Can be one of the following values:
|
รายละเอียดทางเทคนิค
ทำงานใน: | จากการเข้าถึง 2000 |
---|
ตัวอย่างเพิ่มเติม
ตัวอย่าง
ส่งกลับความแตกต่างระหว่างวันที่สองวันในเดือน:
SELECT DateDiff("m", #13/01/1998#, #09/05/2017#);
ตัวอย่าง
ส่งคืนค่าส่วนต่างระหว่างวันที่ที่ระบุและวันที่ของวันนี้ เป็นวัน:
SELECT DateDiff("d", #13/01/1998#, Date());