One can display the lunar calendar JS Code _ Time Date

Source: Internet
Author: User
Copy Code code as follows:

<script language= "JavaScript" >
<!--
var bsyear;
var bsdate;
var Bsweek;
var arrlen=8; Array length
var svalue=0; The number of seconds in the year
var dayiy=0; Days of the Year
var miy=0; Subscript for the Month
var iyear=0; Year mark
var dayim=0; Day of the Month
var spd=86400; Number of seconds per day

var year1999= "30;29;29;30;29;29;30;29;30;30;30;29"; 354
var year2000= "30;30;29;29;30;29;29;30;29;30;30;29"; 354
var year2001= "30;30;29;30;29;30;29;29;30;29;30;29;30"; 384
var year2002= "30;30;29;30;29;30;29;29;30;29;30;29"; 354
var year2003= "30;30;29;30;30;29;30;29;29;30;29;30"; 355
var year2004= "29;30;29;30;30;29;30;29;30;29;30;29;30"; 384
var year2005= "29;30;29;30;29;30;30;29;30;29;30;29"; 354
var year2006= "30;29;30;29;30;30;29;29;30;30;29;29;30";

var month1999= "first month; February; March; April; May; June; July; August; September; October; November; December"
var month2001= "first month; February; March; April; April; May; June; July; August, September;
var month2004= "First month, February, February, March, April, May, June, July, August, September"
var month2006= "First month, February; March; April; May; June; July; July; August; September;
var dn= "; The Hansi of the Duanwu; arrest; when初七because; day; Yanji; 11; 15; 16; 17 18; 19; 20; 14 21; 12; 22; 23.24; 25; 26; 13

var ys=new Array (Arrlen);
ys[0]=919094400; ys[1]=949680000; ys[2]=980265600;
ys[3]=1013443200; ys[4]=1044028800; ys[5]=1074700800;
ys[6]=1107878400; ys[7]=1138464000;

var yn=new Array (Arrlen); The name of the lunar year
Yn[0]= "The years of their own;" Yn[1]= "The Year of Geng Chen"; Yn[2]= "Singonan";
Yn[3]= "The year of the Siren"; yn[4]= "Year"; Yn[5]= "Jia Shen Year";
Yn[6]= "B unitary year"; Yn[7]= "The Year of the" C Xu;
var d=new Date ();
var yy=d.getyear ();
var mm=d.getmonth () +1;
var dd=d.getdate ();
var ww=d.getday ();
if (ww==0) ww= "<font color=red> Sunday";
if (ww==1) ww= "Monday";
if (ww==2) ww= "Tuesday";
if (ww==3) ww= "Wednesday";
if (ww==4) ww= "Thursday";
if (ww==5) ww= "Friday";
if (ww==6) ww= "<font color=red> Saturday";
WW=WW;
var ss=parseint (D.gettime ()/1000);
if (yy<100) yy= "+yy";

for (i=0;i<arrlen;i++)
if (Ss>=ys[i]) ... {
Iyear=i;
Svalue=ss-ys[i]; The number of seconds in the year
}
Dayiy=parseint (SVALUE/SPD) +1; Days of the Year

var dpm=year1999;
if (iyear==1) dpm=year2000;
if (iyear==2) dpm=year2001;
if (iyear==3) dpm=year2002;
if (iyear==4) dpm=year2003;
if (iyear==5) dpm=year2004;
if (iyear==6) dpm=year2005;
if (iyear==7) dpm=year2006;
Dpm=dpm.split (";");

var mn=month1999;
if (iyear==2) mn=month2001;
if (iyear==5) mn=month2004;
if (iyear==7) mn=month2006;
Mn=mn.split (";");

var dn= "; The Hansi of the Duanwu; arrest; when初七because; day; Yanji; 11; 15; 16; 17 18; 19; 20; 14 21; 12; 22; 23.24; 25; 26; 13
Dn=dn.split (";");

Dayim=dayiy;

var total=new Array (13);
Total[0]=parseint (Dpm[0]);
for (i=1;i<dpm.length-1;i++) Total[i]=parseint (Dpm[i]) +total[i-1];
for (i=dpm.length-1;i>0;i--)
if (Dayim>total[i-1]) ... {
DAYIM=DAYIM-TOTAL[I-1];
Miy=i;
}
BSWEEK=WW;
bsdate=yy+ "Year" +mm+ "month";
BSDATE2=DD;
Bsyear= "lunar" +yn[iyear];
BSYEAR2=MN[MIY]+DN[DAYIM-1];
if (ss>=ys[7]| | Ss<ys[0]) bsyear=yn[7];
function CAL () ... {
document.write ("<table border= ' 1 ' cellspacing= ' 3 ' width= '" bordercolor= ' #000000 ' bgcolor= ' #FFFFFF ' height= ' 110 ') cellpadding= ' 2 ');
document.write ("<tr><td align= ' center ' ><b><font color= #008040 >" +bsdate+ "</font> <br><font face= ' Arial ' size= ' 6 ' color= #FF8040 > "+bsdate2+" </font><br><font color= #008040 ><span style= ' font-size:10.5pt ' > ');
document.write (bsweek+ "</span><br>" + "<br></b><font color= #9B4E00 >");
document.write (bsyear+ "<br>" +bsyear2+ "</td></tr></table>");
}
-->
</script>
<script language= "JavaScript" >cal ();</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.