实现代码如下:

 

php得到一个时间的当天、当月、当年的起始时间戳<?php   
php得到一个时间的当天、当月、当年的起始时间戳  
$t   =   time();   
php得到一个时间的当天、当月、当年的起始时间戳  
$t1   =   mktime(0,0,0,date("m",$t),date("d",$t),date("Y",$t));   
php得到一个时间的当天、当月、当年的起始时间戳  
$t2   =   mktime(0,0,0,date("m",$t),1,date("Y",$t));   
php得到一个时间的当天、当月、当年的起始时间戳  
$t3   =   mktime(0,0,0,date("m",$t)-1,1,date("Y",$t));   
php得到一个时间的当天、当月、当年的起始时间戳  
$t4   =   mktime(0,0,0,1,1,date("Y",$t));   
php得到一个时间的当天、当月、当年的起始时间戳    
php得到一个时间的当天、当月、当年的起始时间戳  
//测试   
php得到一个时间的当天、当月、当年的起始时间戳
  echo   date("当前   Y-m-d   H:i:s",$t)."   $t<br>";   
php得到一个时间的当天、当月、当年的起始时间戳  
echo   date("今天0点   Y-m-d   H:i:s",$t1)."   $t1<br>";   
php得到一个时间的当天、当月、当年的起始时间戳  
echo   date("今月起点   Y-m-d   H:i:s",$t2)."   $t2<br>";   
php得到一个时间的当天、当月、当年的起始时间戳  
echo   date("上月起点   Y-m-d   H:i:s",$t3)."   $t3<br>";   
php得到一个时间的当天、当月、当年的起始时间戳  
echo   date("今年起点   Y-m-d   H:i:s",$t4)."   $t4<br>";   
php得到一个时间的当天、当月、当年的起始时间戳  
?>   
php得到一个时间的当天、当月、当年的起始时间戳

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-05-19
猜你喜欢
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案