parse_w3cdtf example

error_log( $errormsg, 0);
        }
    }
            function debug ($debugmsg$lvl=E_USER_NOTICE) {
        if ( MAGPIE_DEBUG ) {
            $this->error("MagpieRSS [debug] $debugmsg", $lvl);
        }
    }
}

if ( !function_exists('parse_w3cdtf') ) :
function parse_w3cdtf ( $date_str ) {

    # regex to match W3C date/time formats     $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);

        
Home | Imprint | This part of the site doesn't use cookies.