def date_to_juliandate(year, month, day):
    """Convert year, month, and day to a Julian Date

    Julian Date is the number of days since noon on January 1, 4713 B.C.
    So the returned date will end in .5 because the date refers to midnight.

    :param year: a Gregorian year (B.C. years are negative).
    :param month: a Gregorian month (1-12).
    :param day: a Gregorian day (1-31).
    :return: the Julian Date for the given year, month, and day.

    """
    year1 = year
    month1 = month
    if year1 < 0:
        year1 += 1
    if month in [1, 2]:
        year1 -= 1
        month1 = month + 12
    if year1 > 1582 or year1 == 1582 and month >= 10 and day >= 15:
        a = int(year1 / 100)
        b = 2 - a + int(a / 4)
    else:
        b = 0
    if year1 < 0:
        c = int(365.25 * year1 - 0.75)
    else:
        c = int(365.25 * year1)
    d = int(30.6001 * (month1 + 1))
    return b + c + d + day + 1720994.5
