Warning: opendir(/home/ezic/ezic.info/public_html/w.ezic.info/wp-content/cache/db/2/options//132): Failed to open directory: No such file or directory in /home/ezic/ezic.info/public_html/w.ezic.info/wp-content/plugins/w3-total-cache/Util_File.php on line 158
RSSの「<dc:date>」に入った時間をPHPにて変換! | 開発日々の走り書き~

RSSの「<dc:date>」に入った時間をPHPにて変換!

PHPを使用してRSSから時間を取得する処理で、
<dc:date>内の時間書式が、UTC(世界時刻)?

 ・2011-07-17T04:55:40Z

と表示される。それをDB等に入れやすい書式にしたいんだが、なかなか迷った!
以下の記述で変換完了!

[php]
//※上記省略
$dc = $rssrow->children(‘http://purl.org/dc/elements/1.1/’);
//$dc ・・・ 2011-07-17T04:55:40Z
$date = date(‘Y/m/d H:i:s’, strtotime($dc));
//$date ・・・ 2011/07/17 13:55:40
//※下記省略
[/php]


★参考URL
 ・[株式会社イグニス] simplexml_load_file()でRSS1.0(dc:dateなど)を扱う

スポンサードリンク

コメント

タイトルとURLをコピーしました