Fungsi MS Access DateDiff()
Contoh
Kembalikan selisih antara dua tanggal, dalam tahun:
SELECT DateDiff("yyyy", #13/01/1998#, #09/05/2017#);
Definisi dan Penggunaan
Fungsi DateDiff() mengembalikan perbedaan antara dua tanggal.
Sintaksis
DateDiff(datepart, date1, date2, firstdayofweek,
firstweekofyear)
Nilai Parameter
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:
|
Detail Teknis
Bekerja di: | Dari Akses 2000 |
---|
Lebih Banyak Contoh
Contoh
Mengembalikan selisih antara dua tanggal, dalam bulan:
SELECT DateDiff("m", #13/01/1998#, #09/05/2017#);
Contoh
Kembalikan selisih antara tanggal yang ditentukan dan tanggal hari ini, dalam hari:
SELECT DateDiff("d", #13/01/1998#, Date());