• 时间函数date(),mktime(),strtotime()


    $begin_time = '2018-8';
    //指定月份月初时间戳
    $month_start = strtotime($begin_time);
    //指定月份月末时间戳
    $month_end = mktime(23, 59, 59, date('m', strtotime($begin_time))+1, 00);
    
    //获取本周是第几周
    $date = date('Y-m-d',time());
    $date_week = date("W", strtotime($date));   //本周日期是第几周
    $week_num = date("w", strtotime($date));     //本周日期是星期几
    
    //获取前一天的时间:
    $mytime= date("Y-m-d H:i:s", strtotime("-1 day"));
    
    //获取三天前的时间:
    $mytime= date("Y-m-d H:i:s", strtotime("-3 day"));
    
    //获取前一个月的时间:
    $mytime= date("Y-m-d H:i:s", strtotime("-1 month"));
    
    //获取前3个月的时间:
    $mytime= date("Y-m-d H:i:s", strtotime("-3 month"));
    
    //获取前一个小时的时间:
    $mytime= date("Y-m-d H:i:s", strtotime("-1 hour"));
    
    //获取前一年的时间:
    $mytime= date("Y-m-d H:i:s", strtotime("-1 year"));
    
    //获取本月16日的时间戳
    $end_time = strtotime(date('Y-m-16')); //结束是间 本月16日
    
    //获取上个月16日的时间戳
    $yesterday = strtotime(date('Y-m-16',strtotime('-1month‘)));
  • 相关阅读:
    中国软件技术篇
    create pdf
    我来了
    补丁号
    rdlc里面用VB语法对数值型数据进行Format
    WinForm中有些控件不能添加ToolTip关联的解决方法
    javascript弹出对话框
    省市县关联菜单
    委托与事件
    ASP.NET多文件上传方案
  • 原文地址:https://www.cnblogs.com/zwtqf/p/9653022.html
Copyright © 2020-2023  润新知