//返回指定月份的第一天
function get_the_month_first_day_str($theyear, $themonth) {
return date("Y-m-d", mktime(0, 0, 0, $themonth, 1, $theyear));
}
//返回指定月份的最后一天
function get_the_month_last_day_str($theyear, $themonth) {
$theday = date("t", mktime(0, 0, 0, $themonth, 1, $theyear));
return date("Y-m-d", mktime(0, 0, 0, $themonth, $theday, $theyear));
}
//返回指定日期所在周的第一天(周日为第一天,周一为第二天,以此类推)
function get_the_week_first_day_str($theyear, $themonth, $theday) {
$date = mktime(0, 0, 0, $themonth, $theday, $theyear);
$date = $date - (24 * 60 * 60 * date("w", $date));
return date("Y-m-d", $date);
}
//返回指定日期所在周的最后一天(周日为第一天,周一为第二天,以此类推)
function get_the_week_last_day_str($theyear, $themonth, $theday) {
$date = mktime(0, 0, 0, $themonth, $theday, $theyear);
$date = $date - (24 * 60 * 60 * date("w", $date)) + (24 * 60 * 60 * 6);
return date("Y-m-d", $date);
} 0
0
相关文章
php代码示例怎样操作redis缓存_php操作redis缓存代码示例【示例】
php连接数据库用单例模式好吗_php数据库单例连接法【技巧】
PHP中mktime()函数参数类型错误的解决方案
PHP 中 mktime() 函数因参数类型严格校验导致的致命错误详解
php修改权限保留扩展属性_php extattr保留改法【技巧】
本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门AI工具
相关专题
C++ 设计模式与软件架构
本专题深入讲解 C++ 中的常见设计模式与架构优化,包括单例模式、工厂模式、观察者模式、策略模式、命令模式等,结合实际案例展示如何在 C++ 项目中应用这些模式提升代码可维护性与扩展性。通过案例分析,帮助开发者掌握 如何运用设计模式构建高质量的软件架构,提升系统的灵活性与可扩展性。
14
2026.01.30
热门下载
相关下载
精品课程
相关推荐
/
热门推荐
/
最新课程
支付宝沙箱支付(个人也能用的支付)
共12课时 | 0.6万人学习
搭建网站 vscode+xdebug调试php代码 调试环境搭建
共2课时 | 0.2万人学习
PHP面向对象基础课程(更新中)
共12课时 | 0.7万人学习
最新文章









