PHP date function

How to get current day in format xxxx-xx-xx

For example, I want date in this format


Use format string "Y-m-d"


d: Day of the month, 2 digits with leading zeros , 01 to 31

Y: Year in four digits, examples 1999 or 2016

m: Month with leading zero. 01 - 12