48

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?

Warren Dew
  • 8,790
  • 3
  • 30
  • 44
codereviewanskquestions
  • 13,460
  • 29
  • 98
  • 167

3 Answers3

129

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

Anomie
  • 92,546
  • 13
  • 126
  • 145
18
date("Y-m-d H:i:s"); // This should do it.
zardilior
  • 2,810
  • 25
  • 30
KJYe.Name
  • 16,969
  • 5
  • 48
  • 63
11

I belive the answer is:

echo date('Y-m-d H:i:s');
Patrick Beardmore
  • 1,026
  • 1
  • 11
  • 35