在php中使用时间戳的快速帮助

在php中使用时间戳的快速帮助,php,Php,我正在开发日历应用程序,需要获取每天/每月开始的时间戳等: 最好的方法是什么 //get timestamps for start of (day, month, year) $ts_now = time(); $ts_today = $ts_this_month = $ts_this_year = 我猜…手册: $ts_today = mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) )

我正在开发日历应用程序,需要获取每天/每月开始的时间戳等:

最好的方法是什么

//get timestamps for start of (day, month, year)
$ts_now         = time();
$ts_today      = 
$ts_this_month  =
$ts_this_year   =
我猜…

手册:

$ts_today       = mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) );
$ts_this_month  = mktime( 0, 0, 0, date( 'm' ), 0, date( 'Y' ) );
$ts_this_year   = mktime( 0, 0, 0, 0, 0, date( 'Y' ) );
$ts_today = strtotime('today');
$ts_this_month = strtotime("1st ".date('F')." ".idate('Y'));
$ts_this_year = strtotime( '1st january '.idate('Y') );