Welcome Guest, Not a member yet? Register   Sign In
Very tiny eentsy minor code contribution
#1

[eluser]Unknown[/eluser]
Adding DATE_RFC3339 to the list of supported formats by standard_date. I added this because the W3C's feed validator requires it for dates in Atom feeds:

http://validator.w3.org/feed/docs/error/...9Date.html

Unless I'm missing something really obvious, I'd also recommend removing or changing the DATE_ATOM and DATE_W3C formats, both of which have a mysterious "%Q" token which doesn't seem to be supported by PHP, so it always ends up as the literal 'Q':

http://us3.php.net/manual/en/function.date.php

Code:
/**
* Standard Date
*
* Returns a date formatted according to the submitted standard.
*
* @access    public
* @param    string    the chosen format
* @param    integer    Unix timestamp
* @return    string
*/    
function standard_date($fmt = 'DATE_RFC822', $time = '')
{
    $formats = array(
        'DATE_ATOM'        =>    '%Y-%m-%dT%H:%i:%s%Q',
        'DATE_COOKIE'    =>    '%l, %d-%M-%y %H:%i:%s UTC',
        'DATE_ISO8601'    =>    '%Y-%m-%dT%H:%i:%s%O',
        'DATE_RFC822'    =>    '%D, %d %M %y %H:%i:%s %O',
        'DATE_RFC850'    =>    '%l, %d-%M-%y %H:%m:%i UTC',
        'DATE_RFC1036'    =>    '%D, %d %M %y %H:%i:%s %O',
        'DATE_RFC1123'    =>    '%D, %d %M %Y %H:%i:%s %O',
        'DATE_RSS'        =>    '%D, %d %M %Y %H:%i:%s %O',
        'DATE_W3C'        =>    '%Y-%m-%dT%H:%i:%s%Q',
        'DATE_RFC3339'  =>  '%c'
        );

    if ( ! isset($formats[$fmt]))
    {
        return FALSE;
    }
    
    return mdate($formats[$fmt], $time);
}

If I'm crazy and there's some date format that ends in "Q" I would love to know what it is :-)

(This is my first post, please be gentle!)




Theme © iAndrew 2016 - Forum software by © MyBB