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

MySQL WEEK() Fungsi

Fungsi MySQL

Contoh

Kembalikan nomor minggu untuk tanggal:

SELECT WEEK("2017-06-15");

Definisi dan Penggunaan

Fungsi WEEK() mengembalikan nomor minggu untuk tanggal tertentu (angka dari 0 hingga 53).

Sintaksis

WEEK(date, firstdayofweek)

Nilai Parameter

Parameter Description
date Required.  The date or datetime to extract the week number form
firstdayofweek

Optional. Specifies what day the week starts on. Can be one of the following:

  • 0 - First day of week is Sunday
  • 1 - First day of week is Monday and the first week of the year has more than 3 days
  • 2 - First day of week is Sunday
  • 3 - First day of week is Monday and the first week of the year has more than 3 days
  • 4 - First day of week is Sunday and the first week of the year has more than 3 days
  • 5 - First day of week is Monday
  • 6 - First day of week is Sunday and the first week of the year has more than 3 days
  • 7 - First day of week is Monday

Detail Teknis

Bekerja di: Dari MySQL 4.0

Lebih Banyak Contoh

Contoh

Kembalikan nomor minggu untuk tanggal:

SELECT WEEK("2017-10-25");

Contoh

Kembalikan nomor minggu untuk tanggal sistem saat ini:

SELECT WEEK(CURDATE());

Fungsi MySQL