//Script by Uttam Singha @ bpy.wikipedia.org ; this version is updated for the Bengali Wikipedia var mn = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; var beng_month_name = new Array; beng_month_name[1] = "বৈশাখ"; beng_month_name[2] = "জ্যৈষ্ঠ"; beng_month_name[3] = "আষাঢ়"; beng_month_name[4] = "শ্রাবণ"; beng_month_name[5] = "ভাদ্র"; beng_month_name[6] = "আশ্বিন"; beng_month_name[7] = "কার্তিক"; beng_month_name[8] = "অগ্রহায়ণ"; beng_month_name[9] = "পৌষ"; beng_month_name[10] = "মাঘ"; beng_month_name[11] = "ফাল্গুন"; beng_month_name[12] = "চৈত্র"; var bWeekdays = new Array("রবিবার",                 "সোমবার",                  "মঙ্গলবার",                  "বুধবার",                  "বৃহস্পতিবার",                  "শুক্রবার",                  "শনিবার",                  "রবিবার"); var bmonth_len = ""; var bWeekdays1 = new Array("রবি", "সোম", "মঙ্গল", "বুধ", "বৃহস্পতি", "শুক্র", "শনি", "রবি"); function convert(str) {     var mystr = str.toString();     var outj; // javascript escaped hex     var outj1;     var be = new Array();     be['1'] = "\u09E7";     be['2'] = "\u09E8";     be['3'] = "\u09E9";     be['4'] = "\u09EA";     be['5'] = "\u09EB";     be['6'] = "\u09EC";     be['7'] = "\u09ED";     be['8'] = "\u09EE";     be['9'] = "\u09EF";     be['0'] = "\u09E6";     be[' '] = '';     be['-'] = '-';     outj1 = "";     for (var i = 0; i < mystr.length; i++) {         var ch = mystr.substr(i, 1);         outj = be[ch];         outj1 += outj;     }     return outj1;  }  //var mas_len = [0, 30.92569444, 62.63289352, 94.00184028, 125.4761458, 156.4885417, 186.9247338, 216.8066667, 246.3155787, 275.6427546, 305.0935301, 334.9103588, 365.2587564814815]; var mas_len = [0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 335, 365];  function ModernDate_to_Julianeday(eyear, emonth, eday) {     var julian_eday;      if (emonth < 3) {         eyear = eyear - 1;         emonth = emonth + 12;     }      julian_eday = Math.floor((365.25 * eyear)) + Math.floor(30.59 * (emonth - 2)) + eday + 1721086.5;     if (eyear < 0) {         julian_eday = julian_eday - 1;         if (((eyear % 4) == 0) && (3 <= emonth)) {             julian_eday = julian_eday + 1;         }     }     if (2299160 < julian_eday) {         julian_eday = julian_eday + Math.floor(eyear * 1.0 / 400) - Math.floor(eyear * 1.0 / 100) + 2;     }      return julian_eday; }  function BPM_Date(eyear, emonth, eday) {     var country = "Bangladesh";      var str = "";     var startjd = 0.0;     if (country = "Bangladesh") {         startjd = 1938093.4629; //Bangladesh     }     else {         startjd = 1938093.483733333;     }     var nJD = ModernDate_to_Julianeday(eyear, emonth, eday);     if (nJD < startjd) {         str = " তারিখ সঠিক নয়।\n";     }     else {         var jddiff = nJD - startjd;         var lasteyear = Math.floor(jddiff / 365.2587564814815);         var mesh = startjd + lasteyear * 365.2587564814815;         var lasteday = 0.0;         var ps, ns, bemonth, beday;         for (var i = 0; i < 12; i++) {             ps = mesh + mas_len[i];             ns = mesh + mas_len[i + 1];             if ((nJD >= ps) && (nJD <= Math.floor(ns) + 1.75)) {                 bemonth = i + 1;                 beday = Math.floor(nJD - ps) + 1;             }          } var array = [];           for (var i = 0; i < 13; i++)                      {                          lastday = mesh + mas_len[i];                          var nda = new Date(calData(lastday + 1).toDateString());                          array.push((nda.getMonth()+1) + "/" + nda.getDate() + "/" + nda.getFullYear());                      }                      bmonth_len = array.join(",");     }     return new Array(lasteyear + 1, bemonth, beday);  } function oneDay() {     var now = new Date();     now.setTime(now.getTime() + (now.getTimezoneOffset() + 360) * 60 * 1000);     var eday = now.getDate();     var emonth = now.getMonth();     var eyear = now.getFullYear();     var bcal = BPM_Date(eyear, emonth + 1, eday);     var nJD = ModernDate_to_Julianeday(eyear, emonth + 1, eday);     var bar = Math.floor(nJD + 0.5) % 7 + 1;     var str = convert(bcal[2]) + " " + beng_month_name[bcal[1]] + " " + convert((bcal[0])) + " বঙ্গাব্দ, " + bWeekdays[bar];     return str; } var theDiv = document.getElementById("contentSub");  var content = document.createTextNode(oneDay()); if ( theDiv ) { 	theDiv.appendChild(content); } function calData(jd) { with(Math){ z1 = jd + 0.5; z2 = floor(z1); f = z1 - z2; if(z2 < 2299161)a = z2; else { alf = floor((z2 - 1867216.25)/36524.25); a = z2 + 1 + alf - floor(alf/4); } b = a + 1524; c = floor((b - 122.1)/365.25); d = floor(365.25*c); e = floor((b - d)/30.6001); days = b - d - floor(30.6001*e) + f; kday = floor(days); if(e < 13.5)kmon = e - 1; else kmon = e - 13; if(kmon > 2.5)kyear = c - 4716; if(kmon < 2.5)kyear = c - 4715; hh1 = (days - kday)*24; khr = floor(hh1); kmin = hh1 - khr; ksek = kmin*60; kmin = floor(ksek); ksek = floor((ksek - kmin)*60); if (kday < 10)kday = " " + kday; if (khr < 10)khr = "0" + khr; if (kmin < 10)kmin = "0" + kmin; if (ksek < 10)ksek = "0" + ksek; var dstr = mn[kmon - 1] + " " + kday + ", " + kyear + " " + khr + ":" + kmin + ":00"; //var sDate = new Date(Date.parse("03/20/2012", "MM/dd/yyyy")); s = new Date(dstr);  } return s; }