{"id":17871,"date":"2026-06-27T11:41:02","date_gmt":"2026-06-27T04:41:02","guid":{"rendered":"https:\/\/chanh.me\/?page_id=17871"},"modified":"2026-06-27T11:41:02","modified_gmt":"2026-06-27T04:41:02","slug":"lich-van-nien","status":"publish","type":"page","link":"https:\/\/draff.sieuthitinhoc.com\/index.php\/lich-van-nien\/","title":{"rendered":"L\u1ecbch v\u1ea1n ni\u00ean"},"content":{"rendered":"\n<div id=\"lich-van-nien-chuan\"><\/div>\n\n<style>\n#lich-van-nien-chuan{\n  max-width:1180px;margin:20px auto;font-family:Arial,sans-serif;\n  background:#f3f8ff;border-radius:22px;overflow:hidden;\n  box-shadow:0 15px 40px rgba(0,0,0,.12);color:#0f172a\n}\n.lvc-head{background:linear-gradient(135deg,#078bd8,#005baa);color:#fff;text-align:center;padding:28px 15px}\n.lvc-head h2{margin:0;font-size:34px;font-weight:900;color:#fff}\n.lvc-head p{margin:8px 0 0}\n.lvc-nav{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin-top:18px}\n.lvc-nav button,.lvc-search button{\n  border:0;border-radius:10px;background:#fff;color:#005baa;\n  padding:11px 18px;font-weight:800;cursor:pointer\n}\n.lvc-search{\n  margin:16px;background:#fff;border-radius:16px;padding:16px;\n  display:grid;grid-template-columns:1fr 1fr 1fr auto;gap:12px;\n  box-shadow:0 5px 18px rgba(0,0,0,.07)\n}\n.lvc-field label{display:block;color:#005baa;font-weight:700;margin-bottom:6px}\n.lvc-field select{\n  width:100%;height:44px;border:1px solid #dbe7f3;border-radius:10px;\n  padding:0 12px;font-size:15px;background:#fff\n}\n.lvc-search button{background:#006bd6;color:#fff;align-self:end;height:44px}\n.lvc-body{display:grid;grid-template-columns:1fr 340px;gap:16px;padding:0 16px 16px}\n.lvc-card{background:#fff;border-radius:18px;padding:16px;box-shadow:0 5px 18px rgba(0,0,0,.07)}\n.lvc-title{text-align:center;color:#005baa;font-size:24px;font-weight:900;margin-bottom:14px}\n.lvc-week,.lvc-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:7px}\n.lvc-week div{text-align:center;background:#eef6ff;color:#005baa;border-radius:9px;padding:10px 2px;font-weight:900}\n.lvc-day{min-height:82px;border:1px solid #e2eaf3;border-radius:12px;padding:9px;background:#fff;cursor:pointer}\n.lvc-day:hover{background:#eef8ff;border-color:#0094d9}\n.lvc-muted{opacity:.35}\n.lvc-solar{font-size:22px;font-weight:900}\n.lvc-lunar{font-size:13px;color:#d97706;margin-top:7px}\n.lvc-sun .lvc-solar{color:#dc2626}\n.lvc-sat .lvc-solar{color:#15803d}\n.lvc-active{background:#007bd3!important;color:#fff;border-color:#0065b3}\n.lvc-active .lvc-lunar{color:#fff}\n.lvc-today{outline:3px solid #facc15}\n.lvc-info{text-align:center}\n.lvc-thu{display:inline-block;background:#006bd6;color:#fff;border-radius:999px;padding:8px 32px;font-weight:900}\n.lvc-big{font-size:76px;line-height:1;font-weight:900;color:#006bd6;margin-top:12px}\n.lvc-info h3{font-size:24px;margin:8px 0 16px}\n.lvc-am{background:#fff6df;border:1px solid #ffd48a;border-radius:15px;padding:16px;margin:16px 0}\n.lvc-am b{display:block;color:#005baa;margin-bottom:5px}\n.lvc-am strong{font-size:52px;color:#d97706}\n.lvc-row{display:grid;grid-template-columns:110px 1fr;gap:10px;text-align:left;border-bottom:1px solid #edf2f7;padding:10px 0;font-size:14px}\n.lvc-row b{color:#005baa}\n.lvc-note{margin-top:15px;background:#eaf6ff;color:#005baa;padding:12px;border-radius:10px;text-align:left;font-size:13px}\n@media(max-width:900px){\n  .lvc-search,.lvc-body{grid-template-columns:1fr}\n  .lvc-day{min-height:66px}\n  .lvc-solar{font-size:18px}\n}\n<\/style>\n\n<script>\n(function(){\nconst TZ=7,PI=Math.PI;\nconst CAN=[\"Gi\u00e1p\",\"\u1ea4t\",\"B\u00ednh\",\"\u0110inh\",\"M\u1eadu\",\"K\u1ef7\",\"Canh\",\"T\u00e2n\",\"Nh\u00e2m\",\"Qu\u00fd\"];\nconst CHI=[\"T\u00fd\",\"S\u1eedu\",\"D\u1ea7n\",\"M\u00e3o\",\"Th\u00ecn\",\"T\u1ef5\",\"Ng\u1ecd\",\"M\u00f9i\",\"Th\u00e2n\",\"D\u1eadu\",\"Tu\u1ea5t\",\"H\u1ee3i\"];\nconst THU=[\"Ch\u1ee7 nh\u1eadt\",\"Th\u1ee9 hai\",\"Th\u1ee9 ba\",\"Th\u1ee9 t\u01b0\",\"Th\u1ee9 n\u0103m\",\"Th\u1ee9 s\u00e1u\",\"Th\u1ee9 b\u1ea3y\"];\nfunction pad(n){return String(n).padStart(2,\"0\")}\nfunction vnDate(d){return pad(d.getDate())+\"\/\"+pad(d.getMonth()+1)+\"\/\"+d.getFullYear()}\nfunction key(d){return d.getFullYear()+\"-\"+pad(d.getMonth()+1)+\"-\"+pad(d.getDate())}\nfunction jdFromDate(dd,mm,yy){let a=Math.floor((14-mm)\/12),y=yy+4800-a,m=mm+12*a-3;return dd+Math.floor((153*m+2)\/5)+365*y+Math.floor(y\/4)-Math.floor(y\/100)+Math.floor(y\/400)-32045}\nfunction NewMoon(k){let T=k\/1236.85,T2=T*T,T3=T2*T,dr=PI\/180,J=2415020.75933+29.53058868*k+0.0001178*T2-0.000000155*T3;J+=0.00033*Math.sin((166.56+132.87*T-0.009173*T2)*dr);let M=359.2242+29.10535608*k-0.0000333*T2-0.00000347*T3,Mp=306.0253+385.81691806*k+0.0107306*T2+0.00001236*T3,F=21.2964+390.67050646*k-0.0016528*T2-0.00000239*T3;let C=(0.1734-0.000393*T)*Math.sin(M*dr)+0.0021*Math.sin(2*M*dr)-0.4068*Math.sin(Mp*dr)+0.0161*Math.sin(2*Mp*dr)-0.0004*Math.sin(3*Mp*dr)+0.0104*Math.sin(2*F*dr)-0.0051*Math.sin((M+Mp)*dr)-0.0074*Math.sin((M-Mp)*dr)+0.0004*Math.sin((2*F+M)*dr)-0.0004*Math.sin((2*F-M)*dr)-0.0006*Math.sin((2*F+Mp)*dr)+0.0010*Math.sin((2*F-Mp)*dr)+0.0005*Math.sin((2*Mp+M)*dr);let D=T<-11?0.001+0.000839*T+0.0002261*T2-0.00000845*T3-0.000000081*T*T3:-0.000278+0.000265*T+0.000262*T2;return J+C-D}\nfunction getNewMoonDay(k,tz){return Math.floor(NewMoon(k)+0.5+tz\/24)}\nfunction SunLongitude(jdn){let T=(jdn-2451545.5)\/36525,T2=T*T,dr=PI\/180,M=357.52910+35999.05030*T-0.0001559*T2-0.00000048*T*T2,L0=280.46645+36000.76983*T+0.0003032*T2,DL=(1.914600-0.004817*T-0.000014*T2)*Math.sin(dr*M)+(0.019993-0.000101*T)*Math.sin(2*dr*M)+0.000290*Math.sin(3*dr*M),L=(L0+DL)*dr;return L-PI*2*Math.floor(L\/(PI*2))}\nfunction getSunLongitude(day,tz){return Math.floor(SunLongitude(day-0.5-tz\/24)\/PI*6)}\nfunction getLunarMonth11(yy,tz){let off=jdFromDate(31,12,yy)-2415021,k=Math.floor(off\/29.530588853),nm=getNewMoonDay(k,tz);return getSunLongitude(nm,tz)>=9?getNewMoonDay(k-1,tz):nm}\nfunction getLeapMonthOffset(a11,tz){let k=Math.floor((a11-2415021.076998695)\/29.530588853+0.5),last=0,i=1,arc=getSunLongitude(getNewMoonDay(k+i,tz),tz);do{last=arc;i++;arc=getSunLongitude(getNewMoonDay(k+i,tz),tz)}while(arc!=last&&i<14);return i-1}\nfunction solar2lunar(dd,mm,yy,tz){let dayNumber=jdFromDate(dd,mm,yy),k=Math.floor((dayNumber-2415021.076998695)\/29.530588853),monthStart=getNewMoonDay(k+1,tz);if(monthStart>dayNumber)monthStart=getNewMoonDay(k,tz);let a11=getLunarMonth11(yy,tz),b11=a11,lunarYear;if(a11>=monthStart){lunarYear=yy;a11=getLunarMonth11(yy-1,tz)}else{lunarYear=yy+1;b11=getLunarMonth11(yy+1,tz)}let lunarDay=dayNumber-monthStart+1,diff=Math.floor((monthStart-a11)\/29),lunarLeap=0,lunarMonth=diff+11;if(b11-a11>365){let leap=getLeapMonthOffset(a11,tz);if(diff>=leap){lunarMonth=diff+10;if(diff==leap)lunarLeap=1}}if(lunarMonth>12)lunarMonth-=12;if(lunarMonth>=11&&diff<4)lunarYear-=1;return{d:lunarDay,m:lunarMonth,y:lunarYear,leap:lunarLeap}}\nfunction canChiYear(y){return CAN[(y+6)%10]+\" \"+CHI[(y+8)%12]}\nfunction canChiDay(d,m,y){let jd=jdFromDate(d,m,y);return CAN[(jd+9)%10]+\" \"+CHI[(jd+1)%12]}\n\nlet today=new Date(), selected=new Date(today.getFullYear(),today.getMonth(),today.getDate()), view=new Date(selected.getFullYear(),selected.getMonth(),1);\n\nfunction renderInfo(){\n let l=solar2lunar(selected.getDate(),selected.getMonth()+1,selected.getFullYear(),TZ);\n document.getElementById(\"lvc-info\").innerHTML=`<div class=\"lvc-thu\">${THU[selected.getDay()].toUpperCase()}<\/div><div class=\"lvc-big\">${selected.getDate()}<\/div><h3>Th\u00e1ng ${selected.getMonth()+1} n\u0103m ${selected.getFullYear()}<\/h3><div class=\"lvc-am\"><b>\u00c2M L\u1ecaCH<\/b><strong>${l.d}<\/strong><div>Th\u00e1ng ${l.m}${l.leap?\" nhu\u1eadn\":\"\"} n\u0103m ${l.y}<\/div><\/div><div class=\"lvc-row\"><b>D\u01b0\u01a1ng l\u1ecbch<\/b><span>${THU[selected.getDay()]}, ${vnDate(selected)}<\/span><\/div><div class=\"lvc-row\"><b>\u00c2m l\u1ecbch<\/b><span>${l.d}\/${l.m}\/${l.y}${l.leap?\" nhu\u1eadn\":\"\"}<\/span><\/div><div class=\"lvc-row\"><b>N\u0103m \u00e2m<\/b><span>${canChiYear(l.y)}<\/span><\/div><div class=\"lvc-row\"><b>Ng\u00e0y can chi<\/b><span>${canChiDay(selected.getDate(),selected.getMonth()+1,selected.getFullYear())}<\/span><\/div><div class=\"lvc-note\">L\u1ecbch \u00e2m Vi\u1ec7t Nam t\u00ednh theo m\u00fai gi\u1edd GMT+7.<\/div>`;\n}\nfunction render(){\n let m=view.getMonth()+1,y=view.getFullYear(),start=new Date(y,m-1,1);start.setDate(1-start.getDay());\n let days=Array.from({length:31},(_,i)=>`<option value=\"${i+1}\" ${i+1==selected.getDate()?\"selected\":\"\"}>Ng\u00e0y ${i+1}<\/option>`).join(\"\");\n let months=Array.from({length:12},(_,i)=>`<option value=\"${i}\" ${i==selected.getMonth()?\"selected\":\"\"}>Th\u00e1ng ${i+1}<\/option>`).join(\"\");\n let years=Array.from({length:201},(_,i)=>y-100+i).map(v=>`<option value=\"${v}\" ${v==selected.getFullYear()?\"selected\":\"\"}>${v}<\/option>`).join(\"\");\n let html=`<div class=\"lvc-head\"><h2>L\u1ecbch v\u1ea1n ni\u00ean<\/h2><p>L\u1ecbch d\u01b0\u01a1ng - L\u1ecbch \u00e2m Vi\u1ec7t Nam<\/p><div class=\"lvc-nav\"><button id=\"prev\">\u2039 Th\u00e1ng tr\u01b0\u1edbc<\/button><button id=\"now\">H\u00f4m nay<\/button><button id=\"next\">Th\u00e1ng sau \u203a<\/button><\/div><\/div><div class=\"lvc-search\"><div class=\"lvc-field\"><label>Ch\u1ecdn ng\u00e0y<\/label><select id=\"day\">${days}<\/select><\/div><div class=\"lvc-field\"><label>Ch\u1ecdn th\u00e1ng<\/label><select id=\"month\">${months}<\/select><\/div><div class=\"lvc-field\"><label>Ch\u1ecdn n\u0103m<\/label><select id=\"year\">${years}<\/select><\/div><button id=\"go\">Xem<\/button><\/div><div class=\"lvc-body\"><div class=\"lvc-card\"><div class=\"lvc-title\">Th\u00e1ng ${m} n\u0103m ${y}<\/div><div class=\"lvc-week\"><div>CN<\/div><div>T2<\/div><div>T3<\/div><div>T4<\/div><div>T5<\/div><div>T6<\/div><div>T7<\/div><\/div><div class=\"lvc-grid\">`;\n for(let i=0;i<42;i++){let d=new Date(start);d.setDate(start.getDate()+i);let l=solar2lunar(d.getDate(),d.getMonth()+1,d.getFullYear(),TZ);html+=`<div class=\"lvc-day ${d.getMonth()!=view.getMonth()?\"lvc-muted\":\"\"} ${d.getDay()==0?\"lvc-sun\":\"\"} ${d.getDay()==6?\"lvc-sat\":\"\"} ${key(d)==key(today)?\"lvc-today\":\"\"} ${key(d)==key(selected)?\"lvc-active\":\"\"}\" data-date=\"${key(d)}\"><div class=\"lvc-solar\">${d.getDate()}<\/div><div class=\"lvc-lunar\">${l.d==1?l.d+\"\/\"+l.m+(l.leap?\"N\":\"\"):l.d}<\/div><\/div>`}\n html+=`<\/div><\/div><div class=\"lvc-card lvc-info\" id=\"lvc-info\"><\/div><\/div>`;\n document.getElementById(\"lich-van-nien-chuan\").innerHTML=html;renderInfo();\n\n document.querySelectorAll(\".lvc-day\").forEach(el=>el.onclick=()=>{let a=el.dataset.date.split(\"-\").map(Number);selected=new Date(a[0],a[1]-1,a[2]);view=new Date(a[0],a[1]-1,1);render()});\n document.getElementById(\"prev\").onclick=()=>{view.setMonth(view.getMonth()-1);selected=new Date(view.getFullYear(),view.getMonth(),1);render()}\n document.getElementById(\"next\").onclick=()=>{view.setMonth(view.getMonth()+1);selected=new Date(view.getFullYear(),view.getMonth(),1);render()}\n document.getElementById(\"now\").onclick=()=>{today=new Date();selected=new Date(today.getFullYear(),today.getMonth(),today.getDate());view=new Date(selected.getFullYear(),selected.getMonth(),1);render()}\n document.getElementById(\"go\").onclick=()=>{selected=new Date(+year.value,+month.value,+day.value);view=new Date(selected.getFullYear(),selected.getMonth(),1);render()}\n}\nrender();\n})();\n<\/script>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-17871","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/pages\/17871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/comments?post=17871"}],"version-history":[{"count":0,"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/pages\/17871\/revisions"}],"wp:attachment":[{"href":"https:\/\/draff.sieuthitinhoc.com\/index.php\/wp-json\/wp\/v2\/media?parent=17871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}