How do I get the current date in some formats with PHP?

advertisements

This question already has an answer here:

  • PHP, How to get current date in certain format [closed] 3 answers

I want to get current date and time in certain format . and current timestamp minus 15 minutes in certain format .

How do I do this in PHP?


Please try following code :

echo "current time: " .date('Y-m-d h:i:s');

echo "<br>current timestamp minus 15 minutes :". date('Y-m-d H:i:s', strtotime('-15 minutes'));