WEB开发网
开发学院WEB开发ASP 纯ASP代码实现公历转农历(含属相) 阅读

纯ASP代码实现公历转农历(含属相)

 2007-12-10 18:52:33 来源:WEB开发网   
核心提示:有没有试过弄一个公历转农历的程序?今天让我们一起来尝试一下吧:<%'Option Explicit'***' 类名称:ChinaDay' 用途:' 根据输入的日期计算该日期的农历天干地支及当年属相' 使用方法:' 第一个参数为输入参数,不填写默认为当日,纯

有没有试过弄一个公历转农历的程序?今天让我们一起来尝试一下吧:

<%
'Option Explicit
'***********************************************
' 类名称:ChinaDay
' 用途:
'  根据输入的日期计算该日期的农历天干地支及当年属相
' 使用方法:
' 第一个参数为输入参数,不填写默认为当日,
' 只计算1921-2-8之后的日期
' ##-------------------------------------------##
' Dim objChinaDay
' Dim sDay, sWeekDay, sChinaDay, sChinaYear,sChinaAni
' Set objChinaDay = New  ChinaDay
' Call objChinaDay.Action("",sDay,sWeekDay,sChinaYear,sChinaDay,sChinaAni)
' Response.Write sDay&"<BR>"
' Response.Write sWeekDay&"<BR>"
' Response.Write sChinaYear&"<BR>"
' Response.Write sChinaDay&"<BR>"
' Response.Write sChinaAni&"<BR>"
' ##-------------------------------------------##
' Modify By:Babyt(阿泰)
' Mail:  Babyt@mail.csdn.net
' Welcome T
'  http://blog.csdn.net/babyt/
'  http://www.facesun.cn
' Created At: 2005-2-20
' Copyright: 本代码非原创,是2001年收集的,原作者未知。
' License:Free
'*******************************************************
Class ChinaDay
 
 Dim arrWeekName(7), MonthAdd(11), NongliData(99)
 Dim arrTianGan(9), arrDiZhi(11), arrShuXiang(11), arrDayName(30), arrMonName(12)
 Dim curTime, curYear, curMonth, curDay, curWeekday
 Dim i, m, n, k, isEnd, bit, TheDate
 
 '初始化数据
 Sub Class_Initialize()
  '---------------------------------------------------
  '定义显示字串
 
  '星期名
  arrWeekName(0) = "*"
  arrWeekName(1) = "星期日"
  arrWeekName(2) = "星期一"
  arrWeekName(3) = "星期二"
  arrWeekName(4) = "星期三"
  arrWeekName(5) = "星期四"
  arrWeekName(6) = "星期五"
  arrWeekName(7) = "星期六"
 
  '天干名称
  arrTianGan(0) = "甲"
  arrTianGan(1) = "乙"
  arrTianGan(2) = "丙"
  arrTianGan(3) = "丁"
  arrTianGan(4) = "戊"
  arrTianGan(5) = "己"
  arrTianGan(6) = "庚"
  arrTianGan(7) = "辛"
  arrTianGan(8) = "壬"
  arrTianGan(9) = "癸"
 
  '地支名称
  arrDiZhi(0) = "子"
  arrDiZhi(1) = "丑"
  arrDiZhi(2) = "寅"
  arrDiZhi(3) = "卯"
  arrDiZhi(4) = "辰"
  arrDiZhi(5) = "巳"
  arrDiZhi(6) = "午"
  arrDiZhi(7) = "未"
  arrDiZhi(8) = "申"
  arrDiZhi(9) = "酉"
  arrDiZhi(10) = "戌"
  arrDiZhi(11) = "亥"
 
  '属相名称
  arrShuXiang(0) = "鼠"
  arrShuXiang(1) = "牛"
  arrShuXiang(2) = "虎"
  arrShuXiang(3) = "兔"
  arrShuXiang(4) = "龙"
  arrShuXiang(5) = "蛇"
  arrShuXiang(6) = "马"
  arrShuXiang(7) = "羊"
  arrShuXiang(8) = "猴"
  arrShuXiang(9) = "鸡"
  arrShuXiang(10) = "狗"
  arrShuXiang(11) = "猪"
 
  '农历日期名
  arrDayName(0) = "*"
  arrDayName(1) = "初一"
  arrDayName(2) = "初二"
  arrDayName(3) = "初三"
  arrDayName(4) = "初四"
  arrDayName(5) = "初五"
  arrDayName(6) = "初六"
  arrDayName(7) = "初七"
  arrDayName(8) = "初八"
  arrDayName(9) = "初九"
  arrDayName(10) = "初十"
  arrDayName(11) = "十一"

Tags:ASP 代码 实现

编辑录入:coldstar [复制链接] [打 印]
赞助商链接