現在の時刻が毎月1日かどうかを確認します

パブリック関数time()
{

$today = date("Y-m-d");
$day = $this->getthemonth($today);
if ($day[0] == $day[1]) {
    return True;
} else {
    return False;
}

}
function getthemonth($ date)
{ firstday = date( 'Y − m − 0 1'、strtotime(firstday = date( 'Ym-01'、strtotime(
f i r s t d a y=d a t e そしてm0 1s t r t o t i m e 日付));
nowday = date( ′Y − m − d′、strtotime(nowday = date( 'Ym-d'、strtotime(n o w d a y=d a t e そしてmds t r t o t i m e 日付));
lastday = date( 'Y − m − d'、strtotime( "lastday = date( 'Ym-d'、strtotime("l a s t d a y=d a t e そしてmds t r t o t i m e "初日+ 1月-1日"));
配列を返す($ firstday、$ nowday、$ lastday);
}

おすすめ

転載: blog.csdn.net/weixin_43784997/article/details/115292939