如何在时间戳中将秒数设置为00?

I need to get timestamp with seconds set to 00. I do this like this:

$time = time();
$time = substr($time, 0, strlen($time) - 2) . '00';

But the result is still with seconds, for example:

  • 1384512500 2013-11-15 12:48:20
  • 1384512400 2013-11-15 12:46:40

How to remove seconds or set it to 00 ?

$time = time();
$time -= $time % 60;

A timestamp represents the number of seconds since 19xx somewhat. Setting the last 2 digits to zero does not build a DateTime with 00 seconds.

$time = new DateTime();
echo $time->format('Y-m-d H:i'), ':00';

This does.