JS获取农历日期(3)
tmp += "月";
tmp += (cDay < 11) ? "初" : ((cDay < 20) ? "十" : ((cDay < 30) ? "廿" : "三十"));
if (cDay % 10 != 0 || cDay == 10) {
tmp += numString.charAt((cDay - 1) % 10);
}
return tmp;
}
function GetLunarDay(solarYear, solarMonth, solarDay) {
//solarYear = solarYear<1900?(1900+solarYear):solarYear;
if (solarYear < 1921 || solarYear > 2020) {
return "";
} else {
solarMonth = (parseInt(solarMonth) > 0) ? (solarMonth - 1) : 11;
e2c(solarYear, solarMonth, solarDay);
return GetcDateString();
}
}
//调用
var D = new Date();
var yy = D.getFullYear();
var mm = D.getMonth() + 1;
var dd = D.getDate();
var ww = D.getDay();
var ss = parseInt(D.getTime() / 1000);
if (yy < 100) yy = "19" + yy;
function GetCNDate() {
return GetLunarDay(yy, mm, dd);
}
$(document).ready(function () {
var d = GetCNDate();
alert(d);
});
</script>
摘自 那晚雪飞扬
相关新闻>>
- 发表评论
-
- 最新评论 更多>>