What is the function used to output the current date in the format YYYY-MM-DD in PHP?

To output the current date in the format YYYY-MM-DD in PHP, you can use the date() function along with the 'Y-m-d' format specifier. This will return the current date in the desired format.

$currentDate = date('Y-m-d');
echo $currentDate;