接前面发出的贴子,代码也接前。
FUNC DaysPerLunarMonth(lyear,lmonth)
ProcessMagicStr(lyear)
IF lmonth < 0
RETURN interdays
ELSE
RETURN LMDAY[LMonth]
ENDIF
**************************************
FUNC solar2lunar(syear,smonth,sday)
STORE 0 to I, nDay
nDay= 0
IF IsLeapYear(syear)
SMDay[2] = 29
ELSE
* SMDay[2] = 28
ENDIF
ProcessMagicStr(syear)
IF (smonth == 1)
nDay = sday
ELSE
FOR I=1 to smonth-1 step 1
nDay = nDay + SMDay[i]
ENDFOR
nDay = nDay + sday
ENDIF
IF nDay <= SLRangeDay
nDay = nDay - SLRangeDay
ProcessMagicStr(syear-1)
FOR I=12 to 1 step -1
nDay = nDay + LMDAY[i]
IF nDay > 0
EXIT
ENDIF
ENDFOR
lyear = syear - 1
lmonth= I
lday = nDay
ELSE
nDay = nDay - SLRangeDay
FOR I=1 to InterMonth-1 step 1
nDay = nDay - LMDAY[i]
IF nDay <= 0
EXIT
ENDIF
ENDFOR
IF nDay <= 0
lyear = syear
lmonth = I
lday = nDay + LMDAY[i]
ELSE
nDay = nDay - LMDAY[InterMonth]
IF nDay <= 0
lyear = syear
lmonth = InterMonth
lday = nDay + LMDAY[InterMonth]
ELSE
LMDAY[InterMonth] = interdays
FOR I=InterMonth to 12 step 1
nDay = nDay - LMDAY[i]
IF nDay <= 0
EXIT
ENDIF
ENDFOR
IF I= InterMonth
lmonth= 0 - InterMonth
lyear = syear
lday = nDay + LMDAY[i]
ELSE
lmonth =I
lyear = syear
lday = nDay + LMDAY[i]
ENDIF
* LYear = SYear
* LDay = nDay + ThisForm.LMDay[i]
ENDIF
ENDIF
ENDIF
nlYear=lyear
NlMonth=lmonth
NlDay=lday
IF lmonth<0
lmonth=-lmonth
RETURN "闰"+HZMonth[LMonth]+HZday[LDay]
ELSE
RETURN HZMonth[LMonth]+HZday[LDay]
ENDIF
********************************************************
FUNC lSolarTerm(date)
LOCAL baseDateAndTime
LOCAL newDate
LOCAL num
LOCAL tempStr
LOCAL y
LOCAL AAA1
LOCAL AAA2
Y=year(date)
baseDateAndTime=ctod("1900/01/06")
tempStr=""
FOR I=1 To 24
num=365.24219444444444*(y-1900)+(sTermInfo[i]/60/24)
xiaoshi=num-int(num)
IF xiaoshi>=0.91319444444444
num=int(num+1)
ELSE
num=int(num)
ENDIF
newDate=baseDateAndTime+num
AAA1=dtoc(date)
AAA2=ctod(AAA1)
IF newDate=AAA2
tempStr=SolarTerm[i]
EXIT
ENDIF
ENDFOR
RETU tempStr
*********************************************
FUNCTION NMONTH(date)
LOCAL baseDateAndTime2
LOCAL newDate2
LOCAL num2
LOCAL tempStr2
LOCAL y2
Y2=year(date)
baseDateAndTime2=ctod("1900/02/04")
tempStr2 = ""
FOR x= 1 To 12
num2 = 365.24219444444444*(y2-1900)+(sTermInfo1[x]/60/24)
xiaoshi2=num2-int(num2)
IF xiaoshi2>= 0.91319444444444
num2=int(num2+1)
ELSE
num2=int(num2)
ENDIF
newDate2=baseDateAndTime2+num2
IF newDate2>=date
EXIT
ENDIF
ENDFOR
RETURN x
*********************************************
CANCEL