def jday(date):
    """ This function calculates the Julian day of a given date as DD MM YYYY"""
    # year and month
    year = int(date[-4:])
    month = int(date[3:5])
    if month == 1 or month == 2:
        month += 12
        year += -1
    # calculate JD of input time
    A = int(year/100)
    B = int(A/4)
    C = 2-A+B
    D = int(date[:2])
    E = int(365.25*(year+4716))
    F = int(30.6001*(month+1))
    Jd = C+D+E+F-1524.5
    return Jd