获得特定月/年月份的第一天 [英] Getting the first day of the month of a specific month/year

查看:86
本文介绍了获得特定月/年月份的第一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $ month = date('m'); 
$ year = date('Y');
$ from = date('Y-m-d',mktime(0,0,0,$ month,1,$ year));


解决方案

看起来像是正确的方法。你可能想让它成为一个功能。


Is there a better way of returning the date for the first day of a specific month/year, than the following?

$month = date('m');
$year = date('Y');
$from = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year));

解决方案

That looks like the right way to do it to me. You might want to make it a function though.

这篇关于获得特定月/年月份的第一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆