// Returns the current date in "YYYY-MM-DD" format
date('Y-m-d');
// Returns the current date and time in "YYYY-MM-DD HH:MM:SS" format
date('Y-m-d H:i:s');
code
Generate MySQL-Formatted Dates
Use `date()` in PHP to format timestamps. For example, `date('Y-m-d')` gives the current date, and `date('Y-m-d H:i:s')` includes the time.
Date formatting
Backend development
DateTime
Database interaction
Date string
DateTime string