PHP, How to get current date in certain format [duplicate]

2011-03-04 21:00:40

I want to get current date and time in the above format. How do I do this in PHP?


Solution 1:

date('Y-m-d H:i:s'). See the manual for more.

Solution 2:

date("Y-m-d H:i:s"); // This should do it.

Solution 3:

I belive the answer is:

echo date('Y-m-d H:i:s');