parse_w3cdtf [ WordPress Function ]
parse_w3cdtf ( $date_str )
| Defined at: |
|
No description yet.
Source
<?php
function parse_w3cdtf ( $date_str ) {
# regex to match wc3dtf
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
if ( preg_match( $pat, $date_str, $match ) ) {
list( $year, $month, $day, $hours, $minutes, $seconds) =
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]);
# calc epoch for current date assuming GMT
$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
$offset = 0;
if ( $match[11] == 'Z' ) {
# zulu time, aka GMT
}
else {
list( $tz_mod, $tz_hour, $tz_min ) =
array( $match[8], $match[9], $match[10]);
# zero out the variables
if ( ! $tz_hour ) { $tz_hour = 0; }
if ( ! $tz_min ) { $tz_min = 0; }
$offset_secs = (($tz_hour*60)+$tz_min)*60;
# is timezone ahead of GMT? then subtract offset
#
if ( $tz_mod == '+' ) {
$offset_secs = $offset_secs * -1;
}
$offset = $offset_secs;
}
$epoch = $epoch + $offset;
return $epoch;
}
else {
return -1;
}
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Get Dates with an Aggregator | RSS Advisory Board
Jun 17, 2004 ... The strtime method is part of PHP and parse_w3cdtf is part of Magpie. ... You say that you have a parse_w3cdtf function from MagpieRSS that ...
www.rssboard.org - Magie RSS Recipes: Simple PHP RSS How To
Discussion: This recipe only works for RSS 1.0 feeds that include the field. (which is very good RSS style) parse_w3cdtf() is defined in rss_utils.inc , and parses ...
magpierss.sourceforge.net - Issue 48 - as3corelib - DateUtil.parseW3CDTF has small bug with ...
Feb 24, 2008 ... What steps will reproduce the problem? 1. Call DateUtil.parseW3CDTF("2008-01 -22T00:00:00Z") What is the expected output? What do you ...
code.google.com - Docs for page rss.php
void parse_w3cdtf ( $date_str). $date_str. wp_rss (line 876). Display all RSS items in a HTML ordered list. since: 1.5.0. void wp_rss (string $url, [int $ num_items ...
phpdoc.wordpress.org