Tutorial SQL

SQL RUMAH Pengenalan SQL Sintaks SQL Pilih SQL SQL Pilih Berbeda SQL Dimana SQL Dan, Atau, Tidak Perintah SQL Oleh SQL Sisipkan Ke Nilai Null SQL Pembaruan SQL Hapus SQL SQL Pilih Atas SQL Min dan Maks Hitung SQL, Rata-Rata, Jumlah SQL Suka SQL Wildcard SQL In SQL Antara SQL Alias SQL Bergabung Gabung Dalam SQL SQL Kiri Gabung SQL Benar Bergabung Gabung Penuh SQL SQL Self Gabung SQL Union Grup SQL Oleh SQL Memiliki SQL Ada SQL Apa saja, Semua SQL Pilih Ke Sisipkan SQL Ke Pilih Kasus SQL Fungsi SQL Null Prosedur Tersimpan SQL Komentar SQL Operator SQL

Basis Data SQL

SQL Buat DB SQL Drop DB SQL Cadangan DB SQL Buat Tabel Tabel Jatuhkan SQL Tabel Ubah SQL Batasan SQL SQL Bukan Null SQL Unik Kunci Utama SQL Kunci Asing SQL Pemeriksaan SQL SQL Default Indeks SQL Peningkatan Otomatis SQL Tanggal SQL Tampilan SQL Injeksi SQL SQL Hosting Tipe Data SQL

Referensi SQL

Kata Kunci SQL Fungsi MySQL Fungsi SQL Server Fungsi Akses MS Referensi Cepat SQL

Contoh SQL

Contoh SQL Kuis SQL Latihan SQL Sertifikat SQL

Fungsi MS Access DateDiff()

Fungsi Akses MS

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:
  • yyyy = Year
  • q = Quarter
  • m = month
  • y = Day of the year
  • d = Day
  • w = Weekday
  • ww = Week
  • h = hour
  • n = Minute
  • s = Second
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:
  • 0 = Use the NLS API setting
  • 1 = Sunday (this is default)
  • 2 = Monday
  • 3 = Tuesday
  • 4 = Wednesday
  • 5 = Thursday
  • 6 = Friday
  • 7 = Saturday
firstdayofyear Optional. Specifies the first week of the year. Can be one of the following values:
  • 0 = Use the NLS API setting
  • 1 = Use the first week that includes Jan 1st (default)
  • 2 = Use the first week in the year that has at least 4 days
  • 3 = Use the first full week of the year

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());

Fungsi Akses MS