當前位置:成語大全網 - 書法字典 - 日期字典代碼

日期字典代碼

代碼提示:將以下代碼復制到《〈BODY〉區域。

& lt腳本語言=“JavaScript“& gt;

& lt!-

函數CalConv()

{

第壹年= 1998;

last year = 2031;

today = new Date();

solar year = today . get full year();

solar month = today . getmonth()+1;

solar date = today . getdate();

weekday = today . getday();

LunarCal =【

new tagLunarCal(27,5,3,43,1,0,0,1,0,1,0,1,1,1,1,

new tagLunarCal(46,0,4,48,1,0,0,1,0,1,1,1,1,0,1,1,/* 88 */

new tagLunarCal(35,0,5,53,1,1,0,0,1,0,0,1,1,1,0,1,1)/* 89 */

new tagLunarCal(23,4,0,59,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,

new tagLunarCal(42,0,1,4,1,0,1,0,1,0,0,1,0,1,0,1,

新tagLunarCal(31,0,2,9,1,0,1,1,1,0,1,0,1,0,1,0),

新標簽日歷(21,2,3,14,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1)/* 93 */

new tagLunarCal(39,0,5,20,0,1,0,1,0,1,0,1,0,1,0,1,

new tagLunarCal(28,7,6,25,1,0,1,0,1,0,1,1,1,0,1,0,1,

新的tagLunarCal(48,0,0,30,0,0,1,0,1,0,1,1,1,0,1,1,

new tagLunarCal(37,0,1,35,1,0,0,1,0,0,1,1,1,0,1,1,1,1)/* 97 */

新的tagLunarCal(25,5,3,41,1,1,0,1,0,0,1,0,1,0,1,0,1,1,

new tagLunarCal(44,0,4,46,1,0,1,0,1,0,0,1,0,1,0,1,

new tagLunarCal(33,0,5,51,1,0,1,1,0,1,0,0,1,0,1,

new tagLunarCal(22,4,6,56,1,0,1,0,1,0,1,0,1,0,1,1,0,/* 101 */

new tagLunarCal(40,0,1,2,1,0,1,0,1,0,1,0,1,0,1,0,1,0,

new tagLunarCal(30,9,2,7,0,1,0,1,0,1,1,0,1,1,0,1,0,1,

new tagLunarCal(49,0,3,12,0,1,0,0,1,0,1,1,1,0,1,0,1),

new tagLunarCal(38,0,4,17,1,0,1,0,1,0,1,1,0,1,1,0,1,0)/* 105 */

new tagLunarCal(27,6,6,23,0,1,0,1,0,1,0,1,0,1,1,1,

new tagLunarCal(46,0,0,28,0,1,0,1,0,1,0,1,0,1,0,1,1,

新的tagLunarCal(35,0,1,33,0,1,0,1,0,0,1,0,0,1,1,1,

new tagLunarCal(24,4,2,38,0,1,1,0,1,0,1,0,1,0,1,0,1,1)/* 109 */

new tagLunarCal(42,0,4,44,0,1,0,1,0,1,0,1,0,1,0,1,

新tagLunarCal(31,0,5,49,1,0,1,0,1,1,0,1,0,1,0,1,0),

new tagLunarCal(21,2,6,54,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1),

new tagLunarCal(40,0,0,59,0,1,0,0,1,0,1,0,1,1,1,0,1,/* 113 */

new tagLunarCal(28,6,2,5,1,0,1,0,0,1,0,1,0,1,1,1,1,

新tagLunarCal(47,0,3,10,1,0,1,0,1,0,1,1,1,1,0,1),

新tagLunarCal(36,0,4,15,1,0,1,0,1,0,1,0,1,1,1,0,1,

新的tagLunarCal(25,5,5,20,1,1,0,1,0,1,0,1,1,1,0)/* 117 */

new tagLunarCal(43,0,0,26,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,

new tagLunarCal(32,0,1,31,1,1,0,1,1,0,1,0,1,0,1,0,0,1,0,

new tagLunarCal(22,3,2,36,0,1,1,0,1,0,1,1,0,1,0,1,0);

/*中華民國每月天數*/

SolarCal =【31,28,31,30,31,30,31,31,30,31】;

/*中華民國、平年和閏年每月累計天數*/

solar days =【0,31,59,90,120,151,181,212,243,273,304,334,365,396,0,31,60,91,65438

AnimalIdx =【“馬”、“羊”、“猴”、“雞”、“狗”、“豬”、“鼠”、“牛”、“虎”、“兔”、“龍”和“蛇”】;

LocationIdx =【“南““東““北““西“】;

if(solary ear & lt;=第壹年||太陽能年& gtLASTYEAR)返回1;

sm = solar month-1;

if(sm & lt;0 | | sm & gt11)返回2;

leap = get leap(solar year);

if(sm = = 1)

d =閏+28;

其他

d = solar cal【sm】;

if(solar date & lt;1 | | solar date & gt;返回3;

y = SolarYear -第壹年;

ACC = solar days【leap * 14+sm】+solar date;

KC = ACC+lunar cal【y】。BaseKanChih

Kan = KC % 10;

chih = KC % 12;

location = location idx【KC % 4】;

年齡= kc % 60

如果(年齡& lt22 )

年齡= 22 -年齡;

其他

年齡= 82 -年齡;

animal = AnimalIdx【Chih】;

if(ACC & lt;= lunar cal【y】。基準日){

y-;

lunar year = solar year-1;

leap = get leap(lunar year);

sm+= 12;

ACC = solar days【leap * 14+sm】+solar date;

}

其他

LunarYear = SolarYear

l 1 = lunar cal【y】。基準日;

for(I = 0;我& lt13;i++ ) {

L2 = l 1+lunar cal【y】。month days【I】+29;

if(ACC & lt;= L2)break;

l 1 = L2;

}

lunar month = I+1;

lunar date = ACC-l 1;

im = lunar cal【y】。插層;

如果(im!= 0 & amp& amp新月& gtim ){

lunar month-;

if(lunar month = = im)lunar month =-im;

}

if(lunar month & gt;12)lunar month-= 12;

today = new Date();

函數init array(){

this . length = initarray . arguments . length

for(var I = 0;我& ltthis .長度;i++)

this【I+1】= init array . arguments【I】}

Var d=new initArray(“星期日“、“星期壹“、“星期二“、“星期三“、“星期四“、“星期五“、“星期六“);

document . write(“& lt;span class =“jsdhtml“& gt,today.getYear(),“年”,today . getmonth()+1,“月”,today.getDate(),“日”,d【today . getday()+1】,““);

document . write(“& lt;span class =“jsdhtml“& gt。& ltu & gt農歷“+LunarMonth+“月“+LunarDate+“日);

Document.write(“沙“+地點+“沖“+動物+年齡+“歲

返回0;

}

/*查找民國年是否為閏年,返回0為平年,1為閏年*/

函數GetLeap(年份)

{

if(year % 400 = = 0)

返回1;

else if(year % 100 = = 0)

返回0;

else if(year % 4 = = 0)

返回1;

其他

返回0;

}

函數標簽lunar cal(d,I,w,k,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m 13 ){

這個。base days = d;/*民國65438+十月65438至正月初壹的累計天數*/

這個。夾層= I;/*閏月。0==今年沒有閏月*/

這個。base weekday = w;/*壹年中的哪壹天是65438+10月1減去1 */

這個。basekanchi = k;/*本年幹支序號為65438+1 */

這個。month days =【m 1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12,m 13】;/*農歷年中每個月的大小,0==小月(29日),1==大嶽(30日)*/

}

//--& gt;

CalConv();

& lt/script & gt;