[PHP-users 12874] Re: date 、mktime 関数について

Katsuhiro Saito php-users@php.gr.jp
Wed, 29 Jan 2003 14:38:20 +0900


2月29日は存在しないから3月になってしまうんじゃないでしょうか?
date("m", strtotime("+1 month"));
でどうでしょうか?


   "[PHP-users 12873] date、mktime 関数について" において、
   "oh@aaron.co.jp"さんは書きました:

> お世話になっております。たくと申します。
> 環境:windows2000, IIS5.0, php4.0.6
> 
> $this_month_mktime = mktime (0,0,0,date("m"),date("d"),date("Y"));
> $next_month_mktime = mktime (0,0,0,date("m")+1,date("d"),date("Y"));
> echo "/".date("Y",$this_month_mktime)."/".date("m",$this_month_mktime)."/log.txt<br>";
> echo "/".date("Y",$next_month_mktime)."/".date("m",$next_month_mktime)."/log.txt<br>";
> 結果:
> /2003/01/log.txt
> /2003/03/log.txt になっています。
> 
> "/2003/02/log.txt"の取り方をご教授頂けますか?

----------------------------
Katsuhiro Saito(齊藤 勝弘)
katsuhiro@teruya.co.jp