def fitsdate(date):
    """
-----------------------------------------------------------------------
Purpose:   Given a string from a FITS file, try to parse it and 
           convert the string into three parts: an integer year, an
           integer month and a fractional day.
Input:     A string, representing a date in FITS format
Returns:   Integer year, integer month, fractional day.
Reference: -
Notes:     Process the FITS dates as part of the 'epochs' function. 
           It processes the following formats:
           DD/MM/YY or DD/MM/19YY
           YYYY-MM-DD
           YYYY-MM-DDTHH:MM:SS
-----------------------------------------------------------------------
   """
    parts = date.split('/')
    if len(parts) == 3:
        return int(parts[2]) % 1900 + 1900, int(parts[1]), float(parts[0])
    parts = date.split('T')
    if len(parts) == 2:
        date = parts[0]
        parts = parts[1].split(':')
        facts = 3600.0, 60.0, 1.0
        time = 0.0
        for i in range(len(parts)):
            time += float(parts[i]) * facts[i]
    else:
        time = 0.0
    parts = date.split('-')
    return int(parts[0]), int(parts[1]), float(parts[2]) + time / 86400.0
