日期:2012-12-04  浏览次数:20898 次

                 使用ASP编写农历算法          
    新年将近,呵呵,写了一个阴历和阳历的ASP程序,就当给大家的新年贺礼
(呵呵,这下蓝先生满意啦把,就当我送给你的圣诞礼物把。。。)
希望大家能够喜欢。。。大家可以很方便的将这个农历加入到自己的主页中
中国人使用中国人自己的日历,呵呵,希望大家以后能够支持Chinaasp的
共同进步。。。
一共两个文件cal.asp和cal2.inc(主要是常量的定义)
cal.asp代码如下
<!--#include virtual="cal2.inc"-->
<%
Function GongDataIsValid(m_date)
    if Not IsDate(m_date) Then
        GongDataIsValid = False
        Exit Function
    else
        if Year(m_date) >1950 AND Year(m_date) < 2050 Then
            GongDataIsValid = true
            Exit Function
        else
            if Year(m_date)=1950 Then
                if Month(m_date)>2 Then
                    GongDataIsValid = true
                    Exit Function
                else
                    if Month(m_date)=2 Then
                        if Day(m_date) > 16 Then
                            GongDataIsValid = true
                            Exit Function
                        End If
                    End If
                End If
            End If
        End If
    End If
    GongDataIsValid = FALSE
End Function

Function NongDataIsValid(m_date)
    if Year(m_date) > 1949 AND Year(m_date) < 2049 Then
        NongDataIsValid = true
        Exit Function
    else
        if Year(m_date)=2049 Then
            if Month(m_date.month) < 12 Then
                NongDataIsValid = true
                Exit Function
            else
                if Month