查找js詳細時間碼,年,月,日,周(秒),農歷日期。
函數rung lnl(){ var today = new Date();Var d =新數組("星期日"、"星期壹"、"星期二"、"星期三"、"星期四"、"星期五"、"星期六");var DDDD =(today . getyear()& lt;100 ?today . getyear()+1900:today . getyear())+" year "+(today . getmonth()+1)+" month "+today . getdate()+" day ";DDDD = DDDD+" "+d[today . getday()];DDDD = DDDD+" "+(CnDateofDateStr(today));//DDDD = DDDD+ " " + SolarTerm(今日);document . write(DDDD);}函數DaysNumberofDate(DateGL){ return parse int((date . parse(DateGL)-date . parse(DateGL . getyear()+"/1/1 ")/86400000)+1;}函數CnDateofDate(DateGL){ var cn data =新數組(0x16,0x2a,0xda,0x00,0x83,0x49,0xb6,0x05,0x0e,0x64,0xbb,0x00,0x19,0xb2,0x5b,0x00,0x87,0x6a,0x57,0x04,0x12,0x75,0x2b,0x00,0x1dvar cn month = new Array();var CnMonthDays = new Array();var CnBeginDayvar LeapMonthvar Bytes = new Array();var I;var CnMonthDatavar DaysCountvar CnDaysCountvar結果月;var結果日;var yyyy = dategl . getyear();var mm = dategl . getmonth()+1;var DD = dategl . getdate();if(yyyy & lt;100)yyyy+= 1900;如果((yyyy & lt1997)| |(yyyy & gt;2020)){ return 0;} Bytes[0]= cn data[(yyyy-1997)* 4];bytes[1]= cn data[(yyyy-1997)* 4+1];bytes[2]= cn data[(yyyy-1997)* 4+2];bytes[3]= cn data[(yyyy-1997)* 4+3];if((Bytes[0]& amp;0x80)!= 0){ cn month[0]= 12;} else { cn month[0]= 11;} CnBeginDay =(Bytes[0]& amp;0x7f);CnMonthData = Bytes[1];CnMonthData = CnMonthData & lt& lt8;CnMonthData = CnMonthData | Bytes[2];leap month = Bytes[3];for(I = 15;我& gt=0;I-){ CnMonthDays[15-I]= 29;if(((1 & lt;& ltI)和ampCnMonthData)!= 0){ CnMonthDays[15-I]++;} if(cn month[15-I]= = leap month){ cn month[15-I+1]=-leap month;} else { if(cn month[15-I]& lt;0){ cn month[15-I+1]=-cn month[15-I]+1;} else { cn month[15-I+1]= cn month[15-I]+1;} if(cn month[15-I+1]& gt;12){ cn month[15-I+1]= 1;} } } days count = daysnumborofdate(DateGL)-1;if(days count & lt;=(CnMonthDays[0]-CnBeginDay)){ if((yyyy & gt;1901);& amp(CnDateofDate(新日期((yyyy-1)+"/12/31 "))& lt;0)){ result month =-cn month[0];} else { result month = cn month[0];} result day = CnBeginDay+days count;} else { cndays count = CnMonthDays[0]-CnBeginDay;I = 1;while((cndays count & lt;days count)& amp;& amp(cndays count+CnMonthDays[I]& lt;days count)){ cndays count+= CnMonthDays[I];i++;} result month = cn month[I];result day = days count-cndays count;} if(result month & gt;0){返回結果月* 100 +結果日;} else {返回result month * 100-result day;} }函數CnYearofDate(DateGL){ var YYYY = DateGL . getyear();var MM = dategl . getmonth()+1;var CnMM = parse int(math . ABS(CnDateofDate(DateGL))/100);if(YYYY & lt;100)YYYY+= 1900;if(CnMM & gt;MM)YYYY-;YYYY-= 1864;返回CnEra(YYYY)+“年”;}函數cnmonthofdate(dategl){ var cnmonthstr = new array("零","正","二","三","四","五","六","七","八","九","十","十壹",var月;month = parse int(CnDateofDate(DateGL)/100);如果(月& lt0){ return " leap "+CnMonthStr[-Month]+" Month ";} else { return CnMonthStr[Month]+" Month ";}}函數cnday ofdate(dategl){ var cndaystr = new array("零"、"壹年級"、"二年級"、"三年級"、"四年級"、"五年級"、"六年級"、"七年級"、"八年級"、"九年級"、"十年級)。“15”、“16”、“17”、“18”、“19”、“20”、“21”、“22”、“23”、“24”、“25”、“26”、“27”、“28”、“29”的var日;day =(math . ABS(CnDateofDate(DateGL)))% 100;return CnDayStr[Day];} function DaysNumberofMonth(DateGL){ var mm 1 = DateGL . get year();mm 1 & lt;100 ?mm 1+= 1900:mm 1;var MM2 = mm 1;mm 1+= "/"+(dategl . getmonth()+1);MM2+= "/"+(dategl . getmonth()+2);mm 1+= "/1 ";MM2+= "/1 ";返回parse int((date . parse(MM2)-date . parse(mm 1))/86400000);}函數cnera(yyyy){ var tiangan = new array(" A "、" B "、" C "、" D "、" E "、" Ji "、" G "、" Xin "、" Ren "、" Gui ");//var Dizhi =新數組("子(鼠)"、"醜(牛)"、"陰(虎)"、"毛(兔)"、"陳(龍)"、"斯(蛇)"、//"吳(馬)"和"魏(羊)。Var Dizhi =新陣("子"、"醜"、"陰"、"毛"、"陳"、"斯"、"武"、"衛"、"申"、"酉"、"許"、"海");回天幹[YYYY % 10]+地直[YYYY % 12];}函數cndateofdatestr(dategl){ if(cnmonthofdate(dategl)= = "零月")返回“請調整您的電腦日期!" ;Else返回“農歷:+cnyearofdate(dategl)+”+cnmonthofdate(dategl)+cndayofdate(dategl);}函數節氣(date GL) {var solar termstr =新數組("小寒"、"嚴寒"、"立春"、"雨"、"驚蟄"、"春分"、"清明"、"谷雨"、"長夏"、"小滿"、"芒種"、"中"。var DifferenceInMonth =新數組(1272060,1275495,128180,1289445,1299225,1310355,132138var difference in year = 31556926;var begin time = new Date(1901/1/1);begin time . settime(947120460000);for(;dategl . getyear()& lt;begin time . getyear();){ begin time . settime(begin time . gettime()-difference inyear * 1000);} for(;dategl . getyear()& gt;begin time . getyear();){ begin time . settime(begin time . gettime()+difference inyear * 1000);} for(var M = 0;dategl . getmonth()& gt;begin time . getmonth();m++){ begin time . settime(begin time . gettime()+difference inmonth[M]* 1000);} if(dategl . getdate()& gt;begin time . getdate()){ begin time . settime(begin time . gettime()+difference inmonth[M]* 1000);m++;} if(dategl . getdate()& gt;begin time . getdate()){ begin time . settime(begin time . gettime()+difference inmonth[M]* 1000);M==23?M = 0:m++;} var JQ;if(dategl . getdate()= = begin time . getdate()){ jq = "今天是