import codecs


def read_datetime(filename):
    """Reads time of a spectral PMT or PHD scan

    Parameters
    ----------
    filename: str

    Returns
    -------
    time: str
    """
    f = codecs.open(filename, "r", encoding="utf-8", errors="ignore")
    datetime_string = f.read().split("\n")[2]
    f.close()
    return datetime_string.split(" ")[1] + ";" + datetime_string.split(" ")[2]