(d, local_tz=True)
return ('%04d-%02d-%02dT%02d:%02d:%02d%s' %
            (d.year, d.month, d.day, d.hour, d.minute, d.second,
             _generate_timezone(d, local_tz)))
generate rfc3339 time format
    input :
    d = date type
    local_tz = use local time zone if true,
    otherwise mark as utc

    output :
    rfc3339 string date format. ex : `2008-04-02T20:00:00+07:00`
generate rfc3339 time format
    input :
    d = date type
    local_tz = use local time zone if true,
    otherwise mark as utc
generate rfc3339 time format input : d = date type local_tz = use local time zone if true otherwise mark as utc
def generate_rfc3339(d, local_tz=True):
    """
    generate rfc3339 time format
    input :
    d = date type
    local_tz = use local time zone if true,
    otherwise mark as utc

    output :
    rfc3339 string date format. ex : `2008-04-02T20:00:00+07:00`
    """
    try:
        if local_tz:
            d = datetime.datetime.fromtimestamp(d)
        else:
            d = datetime.datetime.utcfromtimestamp(d)
    except TypeError:
        pass

    if not isinstance(d, datetime.date):
        raise TypeError('Not timestamp or date object. Got %r.' % type(d))

    if not isinstance(d, datetime.datetime):
        d = datetime.datetime(*d.timetuple()[:3])

    return ('%04d-%02d-%02dT%02d:%02d:%02d%s' %
            (d.year, d.month, d.day, d.hour, d.minute, d.second,
             _generate_timezone(d, local_tz)))
def generate_rfc3339 ( d , local_tz = True ) : try : if local_tz : d = datetime . datetime . fromtimestamp ( d ) else : d = datetime . datetime . utcfromtimestamp ( d ) except TypeError : pass if not isinstance ( d , datetime . date ) : raise TypeError ( 'Not timestamp or date object. Got %r.' % type ( d ) ) if not isinstance ( d , datetime . datetime ) : d = datetime . datetime ( * d . timetuple ( ) [ : 3 ] ) return ( '%04d-%02d-%02dT%02d:%02d:%02d%s' % ( d . year , d . month , d . day , d . hour , d . minute , d . second , _generate_timezone ( d , local_tz ) ) )