PHP从Unix时间戳中减去分钟

Eri*_*oni 2 php mysql

我需要从当前的unix时间戳中减去30分钟。

我使用此功能进行打印以打印unix时间戳:

echo time(); //ouput: 1412856148

现在我需要打印time()30分钟。

该如何打印?

Mar*_*cel 5

使用DateTime对象

$time = new DateTime();
$time->modify('-30 minutes');
echo $time->format('U');
Run Code Online (Sandbox Code Playgroud)