🐬
MySQL YYYY-MM-DD
Output: 2025-01-15
Referensi Cepat
String Format
%Y-%m-%d
Output
2025-01-15
Format tanggal sebagai YYYY-MM-DD di MySQL
🐬 MySQL
SELECT DATE_FORMAT(NOW(), '%Y-%m-%d') AS formatted_date;
-- Output: 2025-12-31Parse string tanggal
🐬 MySQL (Parsing)
SELECT STR_TO_DATE('2025-12-31', '%Y-%m-%d') AS parsed_date;
-- Output: 2025-12-31Kode format tanggal MySQL
| Kode | Arti | Contoh |
|---|---|---|
| %d | Day of month (01-31) | 31 |
| %e | Day of month (1-31) | 31 |
| %m | Month (01-12) | 12 |
| %c | Month (1-12) | 12 |
| %Y | Year (4 digits) | 2025 |
| %y | Year (2 digits) | 25 |
| %b | Abbreviated month | Dec |
| %M | Full month name | December |
Format lainnya di MySQL
YYYY-MM-DD di bahasa lain
Dokumentasi Resmi
Untuk informasi lebih lanjut tentang pemformatan tanggal di MySQL, lihat dokumentasi resmi: