<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ks web Design</title>
	<atom:link href="http://blog.ksweb-design.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.ksweb-design.com</link>
	<description>ケーエスウェブデザイン</description>
	<lastBuildDate>Sat, 11 Feb 2012 03:05:28 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>[CakePHP] Bakeコマンドの詳しい説明</title>
		<link>http://blog.ksweb-design.com/cakephp/478.html</link>
		<comments>http://blog.ksweb-design.com/cakephp/478.html#comments</comments>
		<pubDate>Fri, 27 Jan 2012 15:07:49 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=478</guid>
		<description><![CDATA[CakePHP bakeによる高速開発 Bakeの流れを非常に詳しく解説しています。]]></description>
			<content:encoded><![CDATA[<p><a href="http://hijiriworld.com/web/cakephp-bake/" target="_blank">CakePHP bakeによる高速開発</a><br />
Bakeの流れを非常に詳しく解説しています。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/cakephp/478.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>基礎から学ぶ facebookアプリ開発</title>
		<link>http://blog.ksweb-design.com/facebook/464.html</link>
		<comments>http://blog.ksweb-design.com/facebook/464.html#comments</comments>
		<pubDate>Mon, 28 Nov 2011 04:59:48 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=464</guid>
		<description><![CDATA[「基礎から学ぶ facebookアプリ開発」という本を買ってみた。 Facebookアプリに関する本は何冊か読んだが、どれも情報が古くて困った。 （というかFacebookは頻繁に仕様変更するようですね） 今回この本を選んだ理由は次の３つ。 ・情報が新しい（開発ページの設定項目等が最新のレイアウトだった） ・php-SDKを使ったAPIの利用方法が書いてある。 ・CakePHPとの連携例が多く載っていた。 FacebookAPIに関してほとんど知識がなくても、 自分のウォールに自動投稿するとか結構簡単にできた。 最初は他の本やサイトを参考にしてFacebookページを作成していたが、 掲載されている設定画面がどれも古くてかなり迷った。 この本なら最新の設定画面なので、全く困る事はなかった。（2011/11現在）]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.co.jp/gp/product/4863540949/ref=as_li_qf_sp_asin_il?ie=UTF8&#038;tag=httpwwwkshpco-22&#038;linkCode=as2&#038;camp=247&#038;creative=1211&#038;creativeASIN=4863540949"><img border="0" src="http://ws.assoc-amazon.jp/widgets/q?_encoding=UTF8&#038;Format=_SL110_&#038;ASIN=4863540949&#038;MarketPlace=JP&#038;ID=AsinImage&#038;WS=1&#038;tag=httpwwwkshpco-22&#038;ServiceVersion=20070822" ></a><img src="http://www.assoc-amazon.jp/e/ir?t=httpwwwkshpco-22&#038;l=as2&#038;o=9&#038;a=4863540949" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
「基礎から学ぶ facebookアプリ開発」という本を買ってみた。<br />
Facebookアプリに関する本は何冊か読んだが、どれも情報が古くて困った。<br />
（というかFacebookは頻繁に仕様変更するようですね）</p>
<p>今回この本を選んだ理由は次の３つ。<br />
・情報が新しい（開発ページの設定項目等が最新のレイアウトだった）<br />
・php-SDKを使ったAPIの利用方法が書いてある。<br />
・CakePHPとの連携例が多く載っていた。</p>
<p>FacebookAPIに関してほとんど知識がなくても、<br />
自分のウォールに自動投稿するとか結構簡単にできた。</p>
<p>最初は他の本やサイトを参考にしてFacebookページを作成していたが、<br />
掲載されている設定画面がどれも古くてかなり迷った。<br />
この本なら最新の設定画面なので、全く困る事はなかった。（2011/11現在）</p>
<p><script type="text/javascript" src="http://wms.assoc-amazon.jp/20070822/JP/js/link-enhancer-common.js?tag=httpwwwkshpco-22">
</script><br />
<noscript><br />
    <img src="http://wms.assoc-amazon.jp/20070822/JP/img/noscript.gif?tag=httpwwwkshpco-22" alt="" /><br />
</noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/facebook/464.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[javascript] エンターキー押下時にフォーム誤送信を防止するスクリプト</title>
		<link>http://blog.ksweb-design.com/javascript/461.html</link>
		<comments>http://blog.ksweb-design.com/javascript/461.html#comments</comments>
		<pubDate>Tue, 25 Oct 2011 03:48:45 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=461</guid>
		<description><![CDATA[下記スクリプトで、エンターキーによるフォーム送信を無効にできる。 たまに使うこともあると思うので一応メモ。 layoutに追記※cakephpの場合 &#60;?php echo $javascript-&#62;link('enter_block');?&#62; enter_block.js function BlockEnterEvent() { for(i = 0;i &#60; 3;i++){ if (document.forms[i] != null) { var elements = document.forms[i].elements; for (var j=0; j &#60; elements.length; j++) { var e = elements[j]; if (e.type == &#34;text&#34; &#124;&#124; e.type == &#34;file&#34;){ e.onkeypress=BlockEnter; } } } } } function BlockEnter(evt){ evt = (evt) [...]]]></description>
			<content:encoded><![CDATA[<p>下記スクリプトで、エンターキーによるフォーム送信を無効にできる。</p>
<p>たまに使うこともあると思うので一応メモ。</p>
<p>layoutに追記※cakephpの場合</p>
<pre class="brush: plain;">
&lt;?php echo $javascript-&gt;link('enter_block');?&gt;
</pre>
<p>enter_block.js</p>
<pre class="brush: plain;">
	function BlockEnterEvent() {
		for(i = 0;i &lt; 3;i++){
			if (document.forms[i] != null) {
				var elements = document.forms[i].elements;
				for (var j=0; j &lt; elements.length; j++) {
					var e = elements[j];
					if (e.type == &quot;text&quot; || e.type == &quot;file&quot;){
						e.onkeypress=BlockEnter;
					}
				}
			}
		}
	}
	function BlockEnter(evt){
		evt = (evt) ? evt : event;
		var charCode=(evt.charCode) ? evt.charCode :
			((evt.which) ? evt.which : evt.keyCode);
		if ( Number(charCode) == 13 || Number(charCode) == 3) {
			return false;
		} else {
			return true;
		}
	}
	BlockEnterEvent();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/javascript/461.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>手動によるカウンターキャッシュの更新</title>
		<link>http://blog.ksweb-design.com/cakephp/456.html</link>
		<comments>http://blog.ksweb-design.com/cakephp/456.html#comments</comments>
		<pubDate>Mon, 17 Oct 2011 10:25:07 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=456</guid>
		<description><![CDATA[counterCacheは便利だが、どうやら１モデルにつき１つしか登録できないようだ。 たとえばUserモデルとFriendモデルがあるとする。 Userモデルにはfriend_countフィールドがあり、Friendの数がカウンターキャッシュで更新できるようにする場合、Friendモデルには下記のような記述をする var $belongsTo = array( 'User' =&#62; array( 'className' =&#62; 'User', 'foreignKey' =&#62; 'user_id', 'conditions' =&#62; '', 'fields' =&#62; '', 'order' =&#62; '', 'counterCache' =&#62; 'friend_count', 'counterScope' =&#62; array('Friend.status' =&#62; 1), ), ); 単純に友達の数をカウントするだけならこれでいいが、さらに「特に親しい友達の数もカウントしたい」というような要望がある場合は別処理でカウントする必要がある（と思う）。 試しに次のように配列で入れてみたが、結果は上手くうごかなかった。 （Friendモデルにis_favoriteというフィールドを設け、このis_favoriteが1の要素の合計数を、Userモデルのfriend_favorite_countというフィールドに入れたいとする） var $belongsTo = array( 'User' =&#62; array( array( 'className' =&#62; 'User', 'foreignKey' =&#62; 'user_id', 'conditions' =&#62; '', [...]]]></description>
			<content:encoded><![CDATA[<p>counterCacheは便利だが、どうやら１モデルにつき１つしか登録できないようだ。</p>
<p>たとえばUserモデルとFriendモデルがあるとする。<br />
Userモデルにはfriend_countフィールドがあり、Friendの数がカウンターキャッシュで更新できるようにする場合、Friendモデルには下記のような記述をする</p>
<pre class="brush: plain;">
    var $belongsTo = array(
        'User' =&gt; array(
            'className'    =&gt; 'User',
            'foreignKey'   =&gt; 'user_id',
            'conditions'   =&gt; '',
            'fields'       =&gt; '',
            'order'        =&gt; '',
            'counterCache' =&gt; 'friend_count',
            'counterScope' =&gt; array('Friend.status' =&gt; 1),
        ),
    );
</pre>
<p>単純に友達の数をカウントするだけならこれでいいが、さらに「特に親しい友達の数もカウントしたい」というような要望がある場合は別処理でカウントする必要がある（と思う）。</p>
<p>試しに次のように配列で入れてみたが、結果は上手くうごかなかった。<br />
（Friendモデルにis_favoriteというフィールドを設け、このis_favoriteが1の要素の合計数を、Userモデルのfriend_favorite_countというフィールドに入れたいとする）</p>
<pre class="brush: plain;">
    var $belongsTo = array(
        'User' =&gt; array(
            array(
                'className'    =&gt; 'User',
                'foreignKey'   =&gt; 'user_id',
                'conditions'   =&gt; '',
                'fields'       =&gt; '',
                'order'        =&gt; '',
                'counterCache' =&gt; 'friend_count',
                'counterScope' =&gt; array('Friend.status' =&gt; 1),
            ),
            array(
                'className'    =&gt; 'User',
                'foreignKey'   =&gt; 'user_id',
                'conditions'   =&gt; '',
                'fields'       =&gt; '',
                'order'        =&gt; '',
                'counterCache' =&gt; 'friend_favorite_count',
                'counterScope' =&gt; array('Friend.status' =&gt; 1, 'Friend.is_favorite' =&gt; 1),
            ),
        ),
    );
</pre>
<p>で、結局friend_favorite_countの方は、別に処理を書いて更新させることにする。</p>
<p>Friend.php</p>
<pre class="brush: plain;">
    var $actsAs = array('CounterCache');
    var $_del_user_id;

    function afterSave ($created) {
        // 新規登録時
        if ($created) {
            $this-&gt;id = $this-&gt;getLastInsertId();
        }
        $user_id = $this-&gt;Field('user_id');
        $this-&gt;_updateFavoriteCount($user_id);
    }

    function beforeDelete () {
        $this-&gt;_del_user_id = $this-&gt;Field('user_id');
        return true;
    }

    function afterDelete () {
        if ($this-&gt;_del_user_id) {
            $this-&gt;_updateFavoriteCount($this-&gt;_del_user_id);
            return true;
        }
    }

    function _updateFavoriteCount($user_id = null) {
        if (is_null($user_id)) return false;
        $count = $this-&gt;find('count', array('conditions' =&gt; array('Friend.user_id' =&gt; $user_id, 'Friend.favorite' =&gt; 1, 'Friend.status' =&gt; 1)));
        App::import('Model', 'User');
        $User= new User();
        $User-&gt;id = $user_id;
        if ($User-&gt;saveField('friend_favorite_count', $count)) {
            return true;
        }
        return false;
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/cakephp/456.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[jQuery] スムーズスクロール</title>
		<link>http://blog.ksweb-design.com/%ef%bd%8aquery/445.html</link>
		<comments>http://blog.ksweb-design.com/%ef%bd%8aquery/445.html#comments</comments>
		<pubDate>Tue, 19 Jul 2011 09:00:22 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[ｊQuery]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=445</guid>
		<description><![CDATA[$(document).ready(function(){ $('a[href*=#]').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') &#38;&#38; location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length &#38;&#38; $target &#124;&#124; $('[name=' + this.hash.slice(1) +']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({scrollTop: targetOffset}, 1000); return false; } } }); });]]></description>
			<content:encoded><![CDATA[<pre class="brush: plain;">
$(document).ready(function(){
    $('a[href*=#]').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') &amp;&amp; location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length &amp;&amp; $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            }
        }
    });
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/%ef%bd%8aquery/445.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1ヶ月後の日時を取得する</title>
		<link>http://blog.ksweb-design.com/php/442.html</link>
		<comments>http://blog.ksweb-design.com/php/442.html#comments</comments>
		<pubDate>Tue, 28 Jun 2011 02:01:27 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=442</guid>
		<description><![CDATA[/** * * 1ヶ月後の日時を取得する * @param integer $month * @param date $start_date * @return timestamp */ function endOfMonthPeriod($month, $start_date) { $ts1 = strtotime(sprintf('%dmonth -1day', $month), $start_date); $ts2 = mktime(0, 0, 0, date(&#34;m&#34;, $start_date) + (int)$month + 1, 0, date(&#34;y&#34;, $start_date)); return min($ts1, $ts2); }]]></description>
			<content:encoded><![CDATA[<pre class="brush: plain;">
	/**
	 *
	 * 1ヶ月後の日時を取得する
	 * @param integer $month
	 * @param date $start_date
	 * @return timestamp
	 */
	function endOfMonthPeriod($month, $start_date) {
		$ts1 = strtotime(sprintf('%dmonth -1day', $month), $start_date);
		$ts2 = mktime(0, 0, 0, date(&quot;m&quot;, $start_date) + (int)$month + 1, 0, date(&quot;y&quot;, $start_date));
		return min($ts1, $ts2);
	}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/php/442.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A5:SQL mk2の文字化けについて</title>
		<link>http://blog.ksweb-design.com/%e3%83%84%e3%83%bc%e3%83%ab/439.html</link>
		<comments>http://blog.ksweb-design.com/%e3%83%84%e3%83%bc%e3%83%ab/439.html#comments</comments>
		<pubDate>Thu, 07 Apr 2011 01:42:56 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[ツール]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=439</guid>
		<description><![CDATA[データベースのＥＲ図を作成するのにA5:SQL mk-2というツールを利用している。 新しいPC環境でA5：SQLをダンロードして開き、データベースに接続して、テーブルを開いてみるとなぜか日本語部分のデータが全部「?」になっている。 完全に文字化けしているので調べたら下記サイトが見つかった。 http://d.hatena.ne.jp/THE_MIND/20080517 ばっちり治りました。感謝。]]></description>
			<content:encoded><![CDATA[<p>データベースのＥＲ図を作成するのにA5:SQL mk-2というツールを利用している。</p>
<p>新しいPC環境でA5：SQLをダンロードして開き、データベースに接続して、テーブルを開いてみるとなぜか日本語部分のデータが全部「?」になっている。<br />
完全に文字化けしているので調べたら下記サイトが見つかった。</p>
<p><a href="http://d.hatena.ne.jp/THE_MIND/20080517">http://d.hatena.ne.jp/THE_MIND/20080517</a></p>
<p>ばっちり治りました。感謝。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/%e3%83%84%e3%83%bc%e3%83%ab/439.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[CakePHP][jQuery] jQueryでフォームをリセットする</title>
		<link>http://blog.ksweb-design.com/cakephp/435.html</link>
		<comments>http://blog.ksweb-design.com/cakephp/435.html#comments</comments>
		<pubDate>Tue, 29 Mar 2011 08:56:17 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[ｊQuery]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=435</guid>
		<description><![CDATA[ｊQueryを使ってフォーム要素をリセットしてみた。 &#60;?php $this-&#62;Html-&#62;scriptStart();?&#62; $(function(){ // 検索フォームの入力値をリセット $(&#34;button.reset&#34;).click(function(){ $('input[type=&#34;text&#34;], input[type=&#34;radio&#34;], input[type=&#34;checkbox&#34;], select'). val(&#34;&#34;). removeAttr('checked'). removeAttr('selected') }) }) &#60;?php echo $html-&#62;scriptEnd();?&#62; //form echo $form-&#62;create(); echo $form-&#62;text('name'); echo $form-&#62;text('tel'); echo $form-&#62;button('reset', array('class' =&#62; 'reset')); echo $form-&#62;end(); ?&#62; ※jQueryへのパスは適宜変更すること。]]></description>
			<content:encoded><![CDATA[<p>ｊQueryを使ってフォーム要素をリセットしてみた。</p>
<pre class="brush: plain;">
&lt;?php $this-&gt;Html-&gt;scriptStart();?&gt;
$(function(){
	// 検索フォームの入力値をリセット
    $(&quot;button.reset&quot;).click(function(){
        $('input[type=&quot;text&quot;], input[type=&quot;radio&quot;], input[type=&quot;checkbox&quot;], select').
        val(&quot;&quot;).
        removeAttr('checked').
        removeAttr('selected')
    })
})
&lt;?php echo $html-&gt;scriptEnd();?&gt;

//form
echo $form-&gt;create();
echo $form-&gt;text('name');
echo $form-&gt;text('tel');
echo $form-&gt;button('reset', array('class' =&gt; 'reset'));
echo $form-&gt;end();
?&gt;
</pre>
<p>※jQueryへのパスは適宜変更すること。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/cakephp/435.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[CSS] Youtube動画のz-indexが効かない場合の対処法</title>
		<link>http://blog.ksweb-design.com/css/433.html</link>
		<comments>http://blog.ksweb-design.com/css/433.html#comments</comments>
		<pubDate>Thu, 24 Feb 2011 10:08:23 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=433</guid>
		<description><![CDATA[それはjQueryプラグインのthickboxを利用して、lightboxのような表示方法でテキストウィンドウを表示させた時に問題が起きた。 lightbox特有の半透明の黒い背景の上にYoutube動画がクッキリ表示されているではないか。 cssのz-indexプロパティを利用して、レイヤの順番を下げようとしたがちっとも効果がない。 まるで目立ちたがり屋さんのように、何をやっても最前面に出てくるのだ。 で、参考にしたのがこちらのサイト。 http://blogs.yahoo.co.jp/alaya_wave/62726905.html どうやらwmode=transparentという文字列を加えてあげないとだめみたいだ。]]></description>
			<content:encoded><![CDATA[<p>それはjQueryプラグインのthickboxを利用して、lightboxのような表示方法でテキストウィンドウを表示させた時に問題が起きた。</p>
<p>lightbox特有の半透明の黒い背景の上にYoutube動画がクッキリ表示されているではないか。</p>
<p>cssのz-indexプロパティを利用して、レイヤの順番を下げようとしたがちっとも効果がない。</p>
<p>まるで目立ちたがり屋さんのように、何をやっても最前面に出てくるのだ。</p>
<p>で、参考にしたのがこちらのサイト。<a href=" http://blogs.yahoo.co.jp/alaya_wave/62726905.html" target="_blank"></p>
<p>http://blogs.yahoo.co.jp/alaya_wave/62726905.html</a></p>
<p>どうやらwmode=transparentという文字列を加えてあげないとだめみたいだ。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/css/433.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] 日付の扱い方</title>
		<link>http://blog.ksweb-design.com/php/420.html</link>
		<comments>http://blog.ksweb-design.com/php/420.html#comments</comments>
		<pubDate>Sat, 12 Feb 2011 08:18:13 +0000</pubDate>
		<dc:creator>syu</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.ksweb-design.com/?p=420</guid>
		<description><![CDATA[PHPで日付を扱う場合にDateTimeクラスってのがあったのね・・・。 便利すぎる。 &#60;?php $dt = new DateTime(&#34;2100/2/28&#34;); //echo $dt-&#62;format(&#34;Y-m-d&#34;); $tomorrow = new DateTime(&#34;tomorrow&#34;); //echo $tomorrow-&#62;format('明日はY年n月j日です。'); $start_datetime = new DateTime(&#34;2100/1/31&#34;); $end_datetime = clone $start_datetime; $end_datetime-&#62;modify('+1month'); echo $start_datetime-&#62;format('契約期間はY年n月j日から'); echo $end_datetime-&#62;format('Y年n月j日までです。');]]></description>
			<content:encoded><![CDATA[<p>PHPで日付を扱う場合にDateTimeクラスってのがあったのね・・・。<br />
便利すぎる。</p>
<pre class="brush: plain;">
&lt;?php
$dt = new DateTime(&quot;2100/2/28&quot;);
//echo $dt-&gt;format(&quot;Y-m-d&quot;);

$tomorrow = new DateTime(&quot;tomorrow&quot;);
//echo $tomorrow-&gt;format('明日はY年n月j日です。');

$start_datetime = new DateTime(&quot;2100/1/31&quot;);
$end_datetime = clone $start_datetime;
$end_datetime-&gt;modify('+1month');
echo $start_datetime-&gt;format('契約期間はY年n月j日から');
echo $end_datetime-&gt;format('Y年n月j日までです。');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ksweb-design.com/php/420.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

