0
A
回答
0
的Javascript轉換可能是你(AD轉換回歷khorshidi)
<script>
function gmod(n,m){
return ((n%m)+m)%m;
}
function kuwaiticalendar(adjust){
var today = new Date();
if(adjust) {
adjustmili = 1000*60*60*24*adjust;
todaymili = today.getTime()+adjustmili;
today = new Date(todaymili);
}
day = today.getDate();
month = today.getMonth();
year = today.getFullYear();
m = month+1;
y = year;
if(m<3) {
y -= 1;
m += 12;
}
a = Math.floor(y/100.);
b = 2-a+Math.floor(a/4.);
if(y<1583) b = 0;
if(y==1582) {
if(m>10) b = -10;
if(m==10) {
b = 0;
if(day>4) b = -10;
}
}
jd = Math.floor(365.25*(y+4716))+Math.floor(30.6001*(m+1))+day+b-1524;
b = 0;
if(jd>2299160){
a = Math.floor((jd-1867216.25)/36524.25);
b = 1+a-Math.floor(a/4.);
}
bb = jd+b+1524;
cc = Math.floor((bb-122.1)/365.25);
dd = Math.floor(365.25*cc);
ee = Math.floor((bb-dd)/30.6001);
day =(bb-dd)-Math.floor(30.6001*ee);
month = ee-1;
if(ee>13) {
cc += 1;
month = ee-13;
}
year = cc-4716;
if(adjust) {
wd = gmod(jd+1-adjust,7)+1;
} else {
wd = gmod(jd+1,7)+1;
}
iyear = 10631./30.;
epochastro = 1948084;
epochcivil = 1948085;
shift1 = 8.01/60.;
z = jd-epochastro;
cyc = Math.floor(z/10631.);
z = z-10631*cyc;
j = Math.floor((z-shift1)/iyear);
iy = 30*cyc+j;
z = z-Math.floor(j*iyear+shift1);
im = Math.floor((z+28.5001)/29.5);
if(im==13) im = 12;
id = z-Math.floor(29.5001*im-29);
var myRes = new Array(8);
myRes[0] = day; //calculated day (CE)
myRes[1] = month-1; //calculated month (CE)
myRes[2] = year; //calculated year (CE)
myRes[3] = jd-1; //julian day number
myRes[4] = wd-1; //weekday number
myRes[5] = id; //islamic date
myRes[6] = im-1; //islamic month
myRes[7] = iy; //islamic year
return myRes;
}
function writeIslamicDate(adjustment) {
var wdNames = new Array("Ahad","Ithnin","Thulatha","Arbaa","Khams","Jumuah","Sabt");
var iMonthNames = new Array("Muharram","Safar","Rabi'ul Awwal","Rabi'ul Akhir",
"Jumadal Ula","Jumadal Akhira","Rajab","Sha'ban",
"Ramadan","Shawwal","Dhul Qa'ada","Dhul Hijja");
var iDate = kuwaiticalendar(adjustment);
var outputIslamicDate = wdNames[iDate[4]] + ", "
+ iDate[5] + " " + iMonthNames[iDate[6]] + " " + iDate[7] + " AH";
return outputIslamicDate;
}
document.write("<h3>without date adjustment</h3>");
document.write(writeIslamicDate()); //without date adjustment
document.write("<h3>with 1 day date adjustment</h3>");
document.write(writeIslamicDate(1)); //with 1 day date adjustment
</script>
現場演示這裏>>Codefiddle
JavaScript文件,這裏>>hijricalendar-kuwaiti.js
相關問題
- 1. 如何查看或在笨
- 2. 反應 - 我看不到我的迴應
- 3. 如何返回笨
- 4. 我如何在笨
- 5. 笨 - 返回,而不是stdClass的對象我的模型對象
- 6. 如何使用REST笨和應對方法
- 7. 查看在笨
- 8. 我無法在笨
- 9. 我笨回調不工作
- 10. 笨控制器不返回回值查看通過jQuery的
- 11. 顯示效果在我看來,在笨
- 12. 笨 - Smarty的 - 如何笨
- 13. 笨數據查看
- 14. 我應該如何顯示已查看的對象
- 15. 我想知道如何查看回滾對象?
- 16. 如何返回Json對象以查看異步方法
- 17. C#,我如何找回我的對象
- 18. 如何在笨創建類的對象
- 19. f:ajax無法看到我的對話
- 20. 發生反應,使我的看法
- 21. 我應該如何實現「對象查看器/可視化器」?
- 22. 我如何做到這一點的笨
- 23. 如何在笨返回多維數組
- 24. 如何返回error_array();在笨2.2.1
- 25. Laravel返回迴應::查看
- 26. 對VAADIN的看法
- 27. 我笨擴展2.0.2類沒有看到它的父類的方法
- 28. 笨顯示數據,查看
- 29. 在PHP笨循環觀看
- 30. 功能從MY_Controller查看 - 笨
有用什麼你真的想要嗎?如果你想回顯今天的日期回顯日期(「Y-m-d H:i:s」); – 2013-04-29 10:05:06
不要日期日期請閱讀我的問題。我已添加廣告Solar.see字典,PLZ – SAR 2013-04-29 10:18:42