def jdcnv(dt):
    """
    Converts Gregorian dates to Julian days  

    Parameters
    ----------
    dt : DateTime object
        The date. This is interpreted as UTC and the timezone component is not considered.

    Returns
    -------
    Julian day : float

    Notes
    -----

    .. note:: This function was ported from the IDL Astronomy User's Library.

    :IDL - Documentation:

     NAME:
           JDCNV
     PURPOSE:
           Converts Gregorian dates to Julian days   

     EXPLANATION:
           For IDL versions V5.1 or greater, this procedure is superceded by
           JULDAY() function in the standard IDL distribution.   Note, however,
           that prior to V5.1 there wasa bug in JULDAY() that gave answers off
           by 0.5 days. 

     CALLING SEQUENCE:
           JDCNV, YR, MN, DAY, HR, JULIAN

     INPUTS:
           YR = Year, integer scalar or vector
           MN = Month  integer (1-12) scalar or vector
           DAY = Day   integer 1-31) scalar or vector 
           HR  = Hours and fractions of hours of universal time (U.T.), scalar
                  or vector

     OUTPUTS:
           JULIAN = Julian date (double precision) 

     EXAMPLE:
           To find the Julian Date at 1978 January 1, 0h (U.T.)

           IDL> JDCNV, 1978, 1, 1, 0., JULIAN

           will give JULIAN = 2443509.5
     NOTES:
           (1) JDCNV will accept vector arguments 
           (2) JULDATE is an alternate procedure to perform the same function

     REVISON HISTORY:
           Converted to IDL from Don Yeomans Comet Ephemeris Generator,
           B. Pfarr, STX, 6/15/88
           Converted to IDL V5.0   W. Landsman   September 1997
           Added checks on valid month, day ranges W. Landsman July 2008
    """
    L = int((dt.month - 14.0) / 12.0)
    julian = dt.day - 32075 + int(1461 * (dt.year + 4800 + L) / 4.0) + int(
        367 * (dt.month - 2 - L * 12) / 12.0) - int(int(3 * ((dt.year + 
        4900 + L) / 100.0)) / 4.0)
    julian += dt.hour / 24.0 + dt.minute / (24.0 * 60.0
        ) + dt.second / 86400.0 + dt.microsecond / (86400.0 * 1000000.0) - 0.5
    return julian
