chatovod/utils/time.py
def twelve_to_24_clock(hour, period):
    """Convert 12-hour clock format to 24-hour clock format.

    :param hour: the current hour.
    :param period: the current time period. `AM` or `PM`.
    Other values raise an `Exception`.
    """
    if not (hour > 0 and hour <= 12):
        raise ValueError("Invalid 12-hour clock time. Got {0}".format(hour))

    if period not in ("AM", "PM"):
        raise ValueError("Unknown time period {0!r}".format(period))

    if hour == 12:
        return 0

    if period == "PM":
        return hour + 12

    return hour
Convert 12-hour clock format to 24-hour clock format.

    :param hour: the current hour.
    :param period: the current time period. `AM` or `PM`.
    Other values raise an `Exception`.
    
Convert 12-hour clock format to 24-hour clock format.
Convert 12 - hour clock format to 24 - hour clock format .
def twelve_to_24_clock(hour, period):
    if not (hour > 0 and hour <= 12):
        raise ValueError("Invalid 12-hour clock time. Got {0}".format(hour))
    if period not in ("AM", "PM"):
        raise ValueError("Unknown time period {0!r}".format(period))
    if hour == 12:
        return 0
    if period == "PM":
        return hour + 12
    return hour
def twelve_to_24_clock ( hour , period ) : if not ( hour > 0 and hour <= 12 ) : raise ValueError ( "Invalid 12-hour clock time. Got {0}" . format ( hour ) ) if period not in ( "AM" , "PM" ) : raise ValueError ( "Unknown time period {0!r}" . format ( period ) ) if hour == 12 : return 0 if period == "PM" : return hour + 12 return hour
Convert 12-hour clock format to 24-hour clock format.
Convert 12 - hour clock format to 24 - hour clock format .
"""Convert 12-hour clock format to 24-hour clock format.

    :param hour: the current hour.
    :param period: the current time period. `AM` or `PM`.
    Other values raise an `Exception`.
    """
hour
the current hour.
the current hour .
period
the current time period.
the current time period .