MKTIME, PHP date/timestamp YYYY-MM-DD

Mikey1980 picture Mikey1980 · May 13, 2010 · Viewed 79.9k times · Source

I need to query MySQL for the current date (from PHP) in YYYY-MM-DD format... anyone?

Answer

Sarfraz picture Sarfraz · May 13, 2010

MySQL curdate:

You can do in query:

select curdate()

PHP date

echo date('Y-m-d');

If you want to pass your own date format:

echo date('Y-m-d', strtotime($your_date));