欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-03-26 17:50:46
有没有试过弄一个公历转农历的程序?今天让我们一起来尝试一下吧: <%option explicit***********************************************...

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

<%
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
  
  
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) = "十一"