def convert(y, m, d)
      nongDate = []   
      i = 0
      temp = 0
      leap = 0
      baseDate = Date.new(0 + 1900, 1, 31)
         
      objDate = Date.new(y, m, d);
      offset = objDate - baseDate
      nongDate[5] = offset + 40;
      nongDate[4] = 14;

      i = 1900
      while (i < 2050 && offset > 0)
        temp = days_in_lunar_date(i)
        offset -= temp
        nongDate[4] += 12

        i += 1
      end

      if (offset < 0)
        offset += temp
        i -= 1
        nongDate[4] -= 12
      end

      nongDate[0] = i
      nongDate[3] = i - 1864
      leap = leap_month(i) #闰哪个月
      nongDate[6] = 0

      i = 1  
      while(i<13 && offset > 0)
        #闰月
        if (leap > 0 && i == (leap + 1) && nongDate[6] == 0)
          i -= 1
          nongDate[6] = 1
          temp = leap_days( nongDate[0])
        else  
          temp = monthDays( nongDate[0], i)
        end   

        #解除闰月   
        if (nongDate[6] == 1 && i == (leap + 1))
          nongDate[6] = 0  
        end   
          offset -= temp   
          if (nongDate[6] == 0)   
            nongDate[4] += 1  
        end   

        i += 1  
      end   
      
      if (offset == 0 && leap > 0 && i == leap + 1)
        if (nongDate[6] == 1)
          nongDate[6] = 0
        else  
          nongDate[6] = 1
          i -= 1  
          nongDate[4] -= 1  
        end
      end   
      
      if (offset < 0)
        offset += temp
        i -= 1
        nongDate[4] -= 1
      end
      
      nongDate[1] = i
      nongDate[2] = offset + 1
    
      nongDate
    end
def convert(y, m, d)
      nongDate = []   
      i = 0
      temp = 0
      leap = 0
      baseDate = Date.new(0 + 1900, 1, 31)
         
      objDate = Date.new(y, m, d);
      offset = objDate - baseDate
      nongDate[5] = offset + 40;
      nongDate[4] = 14;

      i = 1900
      while (i < 2050 && offset > 0)
        temp = days_in_lunar_date(i)
        offset -= temp
        nongDate[4] += 12

        i += 1
      end

      if (offset < 0)
        offset += temp
        i -= 1
        nongDate[4] -= 12
      end

      nongDate[0] = i
      nongDate[3] = i - 1864
      leap = leap_month(i) #闰哪个月
      nongDate[6] = 0

      i = 1  
      while(i<13 && offset > 0)
        #闰月
        if (leap > 0 && i == (leap + 1) && nongDate[6] == 0)
          i -= 1
          nongDate[6] = 1
          temp = leap_days( nongDate[0])
        else  
          temp = monthDays( nongDate[0], i)
        end   

        #解除闰月   
        if (nongDate[6] == 1 && i == (leap + 1))
          nongDate[6] = 0  
        end   
          offset -= temp   
          if (nongDate[6] == 0)   
            nongDate[4] += 1  
        end   

        i += 1  
      end   
      
      if (offset == 0 && leap > 0 && i == leap + 1)
        if (nongDate[6] == 1)
          nongDate[6] = 0
        else  
          nongDate[6] = 1
          i -= 1  
          nongDate[4] -= 1  
        end
      end   
      
      if (offset < 0)
        offset += temp
        i -= 1
        nongDate[4] -= 1
      end
      
      nongDate[1] = i
      nongDate[2] = offset + 1
    
      nongDate
    end
传出y年m月d日对应的农历.
 year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6