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>";
    }

    }
    }
  • 相关阅读:
    暗通道先验去雾算法及其几何意义的解释
    几种去雾算法介绍
    大气散射模型的推导
    散射介质环境中偏振成像图像的去散射方法
    最近的笔面试题知识整理一
    了解 Web Service
    数梦工厂笔试题回顾一----finally在return之后执行还是之前?
    Struts2的配置文件的加载
    Struts2中Action配置
    struts.xml的语法
  • 原文地址:https://www.cnblogs.com/lejingwei/p/6732245.html
Copyright © 2011-2022 走看看