PHP 中的当前年份和上一年

Ash*_*boo 1 php

$a= date("Y");
Run Code Online (Sandbox Code Playgroud)

数据类型是什么$a:数字或字符串?如果它是一个字符串,我如何在 PHP 中获得前一年?

Pri*_*ank 5

echo date("Y",strtotime("-1 year"));  //last year "2013"
echo date("Y");                       //current year "2014"
Run Code Online (Sandbox Code Playgroud)

也关注这个帖子

还有这个帖子