1.UNIX时间戳   time()

echo time();

php  关于日期的知识总结

2.UNIX时间戳转换为日期用函数: date()

一般形式:date('Y-m-d H:i:s', 1156219870);
即
echo date(date('Y-m-d H:i:s', time()));
或
$showtime = date('Y-m-d H:i:s',time());

显示结果:

php  关于日期的知识总结

3.日期转换为UNIX时间戳用函数:strtotime()

一般形式:strtotime('2010-03-24 08:15:42');
即
echo  strtotime('2010-03-24 08:15:42');

 

4.重置时间

date_default_timezone_set("Asia/Shanghai");   //时区为亚洲上海

 

相关文章:

  • 2021-11-05
  • 2021-08-26
  • 2021-11-03
  • 2021-04-30
  • 2021-12-11
  • 2022-12-23
  • 2022-02-06
  • 2021-08-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-10-27
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案