以下是asp根据当前日期计算出相应的星座,以下主要是比对日期,以上是演示效果
<%
curTime = Now()
curYear = Year(curTime)
function ren_xingzuo(s_riqi)
if s_riqi="" or not isdate(s_riqi) Then exit function
s_riqimonth = right("00" & month(s_riqi),2)
s_riqiday = right("00" & day(s_riqi),2)
s_riqi = trim(s_riqimonth & s_riqiday) '重整月日,0903型
zx_sow = "摩蝎座" '先默认跨年时会使用
if s_riqi>=0120 and s_riqi<=0219 then zx_sow = "水瓶座"
if s_riqi>=0220 and s_riqi<=0320 then zx_sow = "双鱼座"
if s_riqi>=0321 and s_riqi<=0420 then zx_sow = "白羊座"
if s_riqi>=0421 and s_riqi<=0521 then zx_sow = "金牛座"
if s_riqi>=0522 and s_riqi<=0621 then zx_sow = "双子座"
if s_riqi>=0622 and s_riqi<=0722 then zx_sow = "巨蟹座"
if s_riqi>=0723 and s_riqi<=0823 then zx_sow = "狮子座"
if s_riqi>=0824 and s_riqi<=0923 then zx_sow = "处女座"
if s_riqi>=0924 and s_riqi<=1023 then zx_sow = "天秤座"
if s_riqi>=1024 and s_riqi<=1122 then zx_sow = "天蝎座"
if s_riqi>=1123 and s_riqi<=1222 then zx_sow = "射手座"
if s_riqi>=1222 and s_riqi<=0119 then zx_sow = "摩蝎座"
ren_xingzuo = zx_sow
end function
response.write "现在时间:" & curTime & "<br>"
response.write "年份:" & curYear & "<br>"
response.write "星座:" & ren_xingzuo(curTime) & "<br>"
response.end
%>