def mjd(year, month, day, hour=0, minute=0, second=0):
    """
    Calculate the modified Julian date from an ordinary date and time.

    Notes
    -----
    The formulas are taken from Wikipedia.

    Example
    -------
    >>> mjd(2000, 1, 1)
    51544.0
    """
    a = (14 - month) // 12
    y = year + 4800 - a
    m = month + 12 * a - 3
    jdn = day + (153 * m + 2) // 5 + 365 * y + \
        y // 4 - y // 100 + y // 400 - 32045
    jd = jdn + (hour - 12) / 24. + minute / 1400. + second / 86400.
    mjd = jd - 2400000.5
    return mjd