CORRECT_DATE Name
    
    CORRECT_DATE Purpose
    
    This function returns a corrected version of the input date, when the days 
         are out of the range for the month.
Category
         Calendar
Calling Sequence
    
    Result = CORRECT_DATE( Year, Month, Day ) 
    
    Result = CORRECT_DATE( Date ) Inputs
   
    Day:  The input day in the string format 'DD' or integer format DD.  Can 
                 be a vector of length N_DATE.
    
    Date/Year:  If Month and Day are not input, then this is the input date in 
        
        the string format 'YYYY-MM-DD' or the long integer format YYYYMMDD.  
        
        If Month and Day are input, then this is the input year in the string 
        
        format 'YYYY' or integer format YYYY.  Can be a vector of length 
                 N_DATE. 
    
    Month:  The input month in the string format 'MM' or integer format MM.  
                 Can be a vector of length N_DATE.
Keyword Parameters
Outputs
    
    Result:  The corrected output date(s).  If Month and Day are not given 
        
        then it returns the date in the same format as Date;  otherwise if 
        
        Year is a string then it returns the date as a string in the form 
        
        'YYYY-MM-DD', or if Year is an integer then it returns the date as an 
                 integer in the form YYYYMMDD.
Uses
         month_day.pro
         str.pro 
         var_type.pro
Procedure
    
    This function iterates through alterations to the date until it fits the 
    
    standard format.  This currently assumes non-leap years.
Example
    
    The following should give Result = '2009-11-01'. 
      
      Result = correct_date( '2009-10-23' )
Modification History
    
    Written by:  Daithi A. Stone, 2009-11-23. 
    
    Modified:    Benjamin S. Grandey, 2010-02-05 (can now handle leap years).
    
    Modified:    DAS, 2010-02-23 (fixed bug with leap years implementation 
                 that did not allow vector input)