zoukankan      html  css  js  c++  java
  • PHP中的时间

    //获取当前时间的时间戳
    $time = time();
    //获取某个时间点的时间戳
    //2011-9-8 3:4:5
    echo mktime(3,4,5,9,8,2011);
    //设置默认时区
    date_default_timezone_set("PRC");
    //日期格式化
    echo date("Y年m月d日 H:m:s");
    //microtime — 返回当前 Unix 时间戳和微秒数
    $ms = microtime();

    //日历表
    $year = 2017;
    $month = 3;
    $lastMonth = $month-1;
    if($lastMonth ==0)$lastMonth = 12;
    $firstday = mktime(16,23,0,$month,1,$year); //取所给年月的第一天的UNIX时间戳
    $lastDays = mktime(16,23,0,$lastMonth,1,$year);
    $days = date('t',$firstday); //返回指定月份的天数

    echo"<div style=' 300px'>";
    for($i = 1;$i<$days;$i++){
    echo"<p style=' 20px;float: left;border: 1px solid red;margin: 5px 10px 5px 10px'>";
    echo$i;
    echo"</p>";
    }
    echo"</div>";
    echo"<hr style='clear: both'>";
    $week = date("w",$firstday);
    $days = date('t',$firstday); //返回指定月份的天数
    $nowDay = date('t',$lastDays);
    $day = mktime(16,23,0,3,23,2017);
    echo$day;
    echo"<hr>";
    echo$firstday;
    echo"<head><style>p{text-align: center; 40px;height: 30px;line-height: 30px;float: left;margin: 8px;border: 2px solid rebeccapurple}</style></head>";
    echo"<div style=' 420px'>";
    for($j=1;$j<8;$j++){
    if($j==7){
    echo"<p>周日</p>";
    }else{
    echo"<p>周$j</p>";
    }
    }
    for($i = 1;$i<($days+$week);$i++){
    if($i<$week){
    echo"<p style='border: 2px solid lavender'>";
    echo$nowDay-(-$i)-$week+1;
    echo"</p>";
    }else{
    if($day == $firstday){
    echo"<p style='border: 2px solid green;'>";
    echo$i-$week+1;
    echo"</p>";
    }else{
    echo"<p style='border: 2px solid red;'>";
    echo$i-$week+1;
    echo"</p>";
    }

    }
    }
  • 相关阅读:
    假期实践
    每周更新学习进度表
    作业三
    作业一
    作业二
    真实感海洋的绘制(一):基于统计学模型的水面模拟方法
    递推方程的求解
    真实感海洋的绘制(二):使用快速傅里叶变换加速波形计算
    "Mathematical Analysis of Algorithms" 阅读心得
    HTML2
  • 原文地址:https://www.cnblogs.com/ningmeng666/p/6606332.html
Copyright © 2011-2022 走看看