nntp/date.py
def datetimeobj_YmdHMS(value):
    """Convert timestamp string to a datetime object.

    Timestamps strings like '20130618120000' are able to be converted by this
    function.

    Args:
        value: A timestamp string in the format '%Y%m%d%H%M%S'.

    Returns:
        A datetime object.

    Raises:
        ValueError: If timestamp is invalid.

    Note: The timezone is assumed to be UTC/GMT. 
    """
    i = int(value)
    S = i
    M = S//100
    H = M//100
    d = H//100
    m = d//100
    Y = m//100
    return datetime.datetime(
        Y % 10000, m % 100, d % 100, H % 100, M % 100, S % 100, tzinfo=TZ_GMT
    )
def datetimeobj_YmdHMS(value):
    """Convert timestamp string to a datetime object.

    Timestamps strings like '20130618120000' are able to be converted by this
    function.

    Args:
        value: A timestamp string in the format '%Y%m%d%H%M%S'.

    Returns:
        A datetime object.

    Raises:
        ValueError: If timestamp is invalid.

    Note: The timezone is assumed to be UTC/GMT. 
    """
    i = int(value)
    S = i
    M = S//100
    H = M//100
    d = H//100
    m = d//100
    Y = m//100
    return datetime.datetime(
        Y % 10000, m % 100, d % 100, H % 100, M % 100, S % 100, tzinfo=TZ_GMT
    )
Convert timestamp string to a datetime object.

    Timestamps strings like '20130618120000' are able to be converted by this
    function.

    Args:
        value: A timestamp string in the format '%Y%m%d%H%M%S'.

    Returns:
        A datetime object.

    Raises:
        ValueError: If timestamp is invalid.

    Note: The timezone is assumed to be UTC/GMT.