Blogger Information
Blog 263
fans 3
comment 2
visits 113377
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
时间格式转换
福哥的博客
Original
912 people have browsed it

1. 2017-05-09 17:30 转换成 17年05月09日 05点30分

<?php
header("content-type:text/html;charset=utf-8");
$str="2017-05-09 17:30";
$int=strtotime($str);//z转 17年5月23日 5点30分
echo $date=date("y年m月d日 h点i分",$int);
?>

2. 输出过去或将来的时间

<?php
date ('Y-m-d H:i:s',strtotime('-1 day'));
?>

3. 本月的第几个星期几

<?php
header("Content-type:text/html;Charset=utf-8");
//判断今天是本月的第几个星期几
$wk_day=date('w');//得到今天是星期几
$date_now=date('j');//得到今天的日期
$wkday_ar=array('日','一','二','三','四','五','六');
$cal_result=ceil($date_now/7);//计算是第几个星期几
$str=date("Y年n月j日")." 星期".$wkday_ar[$wk_day]." - 本月的第".$cal_result." 个星期".$wkday_ar[$wk_day];
echo $str;
?>


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post