Konversi Tahun Hijriah ke Tahun Masehi

Untitled

Ini sedikit  contoh Source Code Pembuatan konversi hijriah ke tahun masehi :

<html>
<head>
<meta http-equiv=”Content-Language” content=”id”>
<title>Konversi Tahun Hijriah ke Tahun Masehi</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<meta name=”description” content=”Informasi lengkap mengenai ilmu falak dan seputar astronomi Islam berkaitan dengan awal bulan, waktu shalat, arah kiblat dan gerhana”>
<meta name=”keywords” content=”astronomi, ilmu falak, falak, awal bulan islam, arah kiblat, waktu shalat, gerhana, teleskop rukyat, theodolit, hisab, rukyat, software falak, astronomy, astronomical, astronomy calendar, celestial, islamic crescent, moonsighting, qibla, time keeping”>
<link href=”../scripts/style.css” rel=stylesheet type=text/css>
</head>
<body topmargin=”0″ leftmargin=”0″ bgproperties=”fixed”>
<LINK href=”scripts/style.css” rel=stylesheet type=text/css>
<div align=”center”><p style=”margin-bottom: -5; margin-top:-10″></td></div>
<div align=”center”><center>
<table border=”0″ width=”312″ height=”1″ style=”border-collapse: collapse” bordercolor=”#000000″ cellpadding=”0″ cellspacing=”0″>
<tr>
<td vAlign=”top” align=”middle” width=”378″ height=”1″ bgcolor=”#000000″>
<center><font size=”-1″>
<p style=”margin-top: 0; margin-bottom:0″>
<div align=”center”>
<center>
<table border=0 width=295 style=”border-collapse: collapse” cellpadding=”0″ cellspacing=”0″ background=”GREEN” height=”140″><tr>
<td width=”348″ height=”140″ background=”#990011″>
<p style=”margin-top: 0; margin-bottom: 0″ align=”center”><font size=”-1″>
<SCRIPT LANGUAGE=”JavaScript1.1″>
<!– Begin
function right(e) {
if (navigator.appName == ‘Netscape’ &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == ‘Microsoft Internet Explorer’ &&
(event.button == 2 || event.button == 3)) {
alert(“——————————-“);
return false;
}
return true;
}
document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// End –>
</script>
<script>
function weekDay(wdn){
if(wdn==0){
return “Senin”
}
if(wdn==1){
return “Selasa”
}
if(wdn==2){
return “Rabu”
}
if(wdn==3){
return “Kamis”
}
if(wdn==4){
return “Jumat”
}
if(wdn==5){
return “Sabtu”
}
if(wdn==6){
return “Minggu”
}
return “”

}

function pasarDay(pdn){
if(pdn==0){
return “Legi”
}
if(pdn==1){
return “Pahing”
}
if(pdn==2){
return “Pon”
}
if(pdn==3){
return “Wage”
}
if(pdn==4){
return “Kliwon”
}

return “”

}

function isnumeric(num)
{
var strlen = num.length
var i
for ( i = 0; i < strlen ; ++i )
{
//if (!((num.charAt(i) >= ‘0’) && (num.charAt(i)<=’9′) || (num.charAt(i)==’.’)))
if (!((num.charAt(i) >= ‘0’) && (num.charAt(i)<=’9′) || (num.charAt(i)==’.’) || (num.charAt(i)==’-‘)))
{
return false;
}
}
}

</script>
<form name=”Hijri”>
<div align=”center”>
<center>
<table width=”330″ border=”0″ cellspacing=”0″ style=”border-style:solid; border-collapse:collapse” cellpadding=”0″>
<tr valign=”top”>
<td align=”center” style=”border-bottom-style:dotted; border-bottom-width:1px” background=”3.jpg”>
<p style=”margin-bottom: 0; margin-top:0″> <span class=”secondary-header”>
<font face=”Verdana”>
<br>
</font><font color=”#000089″><b><font face=”Verdana” size=4>
Konverter Hijriyah</font></b></font></font><span lang=”en-us”><b><font face=”Verdana” size=”4″ color=”#000080″>=Masehi</font></b></span><font face=”Verdana” size=”2″><font color=”#000080″ size=”3″ align=”center”><br>

</font><b>
<font align=”center” color=”#FF0000″>
Hari ini</font></b></font><font align=”center” face=”Verdana” size=”2″ color=”#FF0000″>
</font>
<font face=”Verdana” size=”2″>
<font align=”center” color=”#FF0000″>
:</font><font face=”Verdana” align=”center”><font color=”#FF0000″>
<SCRIPT language=JavaScript>

document.write(“<font color=’#008000′ font size=’2′ font face=’Trebuchet MS,Arial,Helvetica,Geneva,Swiss,SunSans-Regular’><b>”)
var mydate=new Date()
var year=mydate.getYear()
if (year<2001)
year += (year < 1900) ? 1900 : 0
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym=”0″+daym
var dayarray=new Array(“Minggu”,”Senin”,”Selasa”,”Rabu”,”Kamis”,”Jumat”,”Sabtu”)
var montharray=new Array(“Januari”,”Februari”,”Maret”,”April”,”Mei”,”Juni”,”Juli”,”Agustus”,”September”,”Oktober”,”November”,”Desember”)
document.write(“&nbsp;”+dayarray[day]+”, “+daym+” “+montharray[month]+” “+year+” &nbsp”)
document.write(“</b></i></font>”)
// –>
</SCRIPT>
</font>
<font face=”Verdana” size=”2″>
<p style=”margin-top: 0; margin-bottom: 0″>
<font color=”#FF0000″>
<script type=”text/javascript”>
<!–
//WAKTU: menunjukkan waktu terkini
function myClock()
{
var t = new Date();
var varJam = t.getHours();
var varMenit = t.getMinutes();
var varDetik = t.getSeconds();
var tmp = document.getElementById(“tmpAlert”);
varDetik++;
if (varDetik == 60)
{
varMenit++;
varDetik=0;
}
if (varMenit == 60)
{
if (varJam == 23){varJam=0}
else {varJam++}
varMenit=0;
}
varJam=varJam.toString();
varMenit=varMenit.toString();
varDetik=varDetik.toString();
if (varJam.length==1) varJam=”0″ + varJam;
if (varMenit.length==1) varMenit=”0″ + varMenit;
if (varDetik.length==1) varDetik=”0″ + varDetik;
tmp.innerHTML = varJam + “:” + varMenit + “:” + varDetik + “<input type=\”hidden\” name=\”ClockView\” value=\””+varJam+’:’+varMenit+’:’+varDetik+”\”>”;
setTimeout(“myClock()”, 1000);
}
–>
</script>
<body bgcolor=”#000000″>

<DIV>
<DIV id=printTime><b><font color=”#000000″ face=”Tahoma” style=”font-size: 8pt”>Pukul: <SPAN id=tmpAlert>
<span lang=”en-us”></span>00:00:00
<INPUT type=hidden value=00:00:00 name=ClockView></SPAN>
<SCRIPT language=JavaScript>myClock();</SCRIPT></font></DIV></DIV>

</font></span></td>
</tr>
<tr valign=”top”>

<td style=”border-bottom-style:dotted; border-bottom-width:1px” background=”5.jpg” bordercolor=”#FFFFFF”>
<font face=”Verdana”>&nbsp; </font>
<div align=”center”>
<center>
<table width=”274″ border=”0″ cellpadding=”0″ cellspacing=”0″ style=”border-style:solid; border-width:1px; border-collapse:collapse” height=”261″>

<tr>
<td style=”padding: 5px” colspan=”3″ align=”center” bgcolor=”#202020″ width=”100%” height=”28″>
<font face=”Verdana” color=”#FFFF00″>
<b>Kalender Masehi</b> </font>
</td></tr>

<tr>
<td style=”padding: 5px” bgcolor=”#F6F6F6″ width=”66″ height=”28″>
<p align=”center”>
<font face=”Verdana” style=”font-size: 11pt; font-weight: 700″ color=”#969696″>Tanggal</font></td>
<td style=”padding: 5px” bgcolor=”#F6F6F6″ width=”118″ height=”28″>
<p align=”center”>
<font face=”Verdana” style=”font-size: 11pt; font-weight: 700″ color=”#969696″>Bulan</font></td>
<td style=”padding: 5px” bgcolor=”#F6F6F6″ width=”58″ height=”28″>
<p align=”center”>
<font face=”Verdana” style=”font-size: 11pt; font-weight: 700″ color=”#969696″>Tahun </font>
</td></tr>

<tr>
<td style=”padding: 5px” height=”35″ bgcolor=”#F6F6F6″ width=”66″>
<p align=”center”>
<font face=”Verdana”>
<SELECT name=”CDay” size=”1″>
<OPTION value=1 selected>1</OPTION>
<OPTION value=2>2</OPTION>
<OPTION value=3>3</OPTION>
<OPTION value=4>4</OPTION>
<OPTION value=5>5</OPTION>
<OPTION value=6>6</OPTION>
<OPTION value=7>7</OPTION>
<OPTION value=8>8</OPTION>
<OPTION value=9>9</OPTION>
<OPTION value=10>10</OPTION>
<OPTION value=11>11</OPTION>
<OPTION value=12>12</OPTION>
<OPTION value=13>13</OPTION>
<OPTION value=14>14</OPTION>
<OPTION value=15>15</OPTION>
<OPTION value=16>16</OPTION>
<OPTION value=17>17</OPTION>
<OPTION value=18>18</OPTION>
<OPTION value=19>19</OPTION>
<OPTION value=20>20</OPTION>
<OPTION value=21>21</OPTION>
<OPTION value=22>22</OPTION>
<OPTION value=23>23</OPTION>
<OPTION value=24>24</OPTION>
<OPTION value=25>25</OPTION>
<OPTION value=26>26</OPTION>
<OPTION value=27>27</OPTION>
<OPTION value=28>28</OPTION>
<OPTION value=29>29</OPTION>
<OPTION value=30>30</OPTION>
<OPTION value=31>31</OPTION>
</SELECT> </font>
</td>
<td style=”padding: 5px” height=”35″ bgcolor=”#F6F6F6″ width=”118″>
<p align=”center”>
<font face=”Verdana”>
<SELECT name=”CMonth” size=”1″>
<OPTION value=1 selected>Januari</OPTION>
<OPTION value=2>Februari</OPTION>
<OPTION value=3>Maret</OPTION>
<OPTION value=4>April</OPTION>
<OPTION value=5>Mei</OPTION>
<OPTION value=6>Juni</OPTION>
<OPTION value=7>Juli</OPTION>
<OPTION value=8>Agustus</OPTION>
<OPTION value=9>September</OPTION>
<OPTION value=10>Oktober</OPTION>
<OPTION value=11>November</OPTION>
<OPTION value=12>Desember</OPTION>
</SELECT> </font>

</td>
<td style=”padding: 5px” height=”35″ bgcolor=”#F6F6F6″ width=”58″>
<p align=”center”>
<font face=”Verdana”>
<INPUT value=2007 name=”CYear” size=”6″> </font>
</td></tr>

<tr>
<td style=”padding: 5px” colspan=”3″ align=”center” height=”37″ bgcolor=”#F6F6F6″ width=”100%”>
<font face=”Verdana”>
<INPUT onclick=GregToIsl(this.form) type=button value=”Ubah Masehi ke Hijriyah” name=”GtoH” style=”font-weight: bold”>
</font>
</td>
</tr>

<tr>
<td style=”padding: 5px” height=”9″ width=”66″>
</td>
<td style=”padding: 5px” height=”9″ width=”118″></td>
<td style=”padding: 5px” height=”9″ width=”58″></td>
</tr>

<tr>
<td colspan=”3″ bgcolor=”#202020″ align=”center” bordercolor=”#000000″ height=”30″ width=”100%”>
<font face=”Verdana” color=”#00FF00″>
<b>Kalender Hijriyah</b></font></td>
</tr>

<tr>
<td bgcolor=”#F6F6F6″ height=”22″ width=”76″>
<p align=”center”>
<font face=”Verdana” style=”font-size: 11pt; font-weight: 700″ color=”#969696″>Tanggal </font>
</td>
<td bgcolor=”#F6F6F6″ height=”22″ width=”128″>
<p align=”center”>
<font face=”Verdana” style=”font-size: 11pt; font-weight: 700″ color=”#969696″>Bulan</font></td>
<td bgcolor=”#F6F6F6″ height=”22″ width=”68″>
<p align=”center”>
<font face=”Verdana” style=”font-size: 11pt; font-weight: 700″ color=”#969696″>Tahun </font>
</td></tr>

<tr>
<td height=”35″ bgcolor=”#F6F6F6″ width=”76″>

<p align=”center”>

<font face=”Verdana”>

<SELECT name=”HDay” size=”1″>
<OPTION value=1 selected>1</OPTION>
<OPTION value=2>2</OPTION>
<OPTION value=3>3</OPTION>
<OPTION value=4>4</OPTION>
<OPTION value=5>5</OPTION>
<OPTION value=6>6</OPTION>
<OPTION value=7>7</OPTION>
<OPTION value=8>8</OPTION>
<OPTION value=9>9</OPTION>
<OPTION value=10>10</OPTION>
<OPTION value=11>11</OPTION>
<OPTION value=12>12</OPTION>
<OPTION value=13>13</OPTION>
<OPTION value=14>14</OPTION>
<OPTION value=15>15</OPTION>
<OPTION value=16>16</OPTION>
<OPTION value=17>17</OPTION>
<OPTION value=18>18</OPTION>
<OPTION value=19>19</OPTION>
<OPTION value=20>20</OPTION>
<OPTION value=21>21</OPTION>
<OPTION value=22>22</OPTION>
<OPTION value=23>23</OPTION>
<OPTION value=24>24</OPTION>
<OPTION value=25>25</OPTION>
<OPTION value=26>26</OPTION>
<OPTION value=27>27</OPTION>
<OPTION value=28>28</OPTION>
<OPTION value=29>29</OPTION>
<OPTION value=30>30</OPTION>
</SELECT> </font>
</td>
<td height=”35″ bgcolor=”#F6F6F6″ width=”128″>
<p align=”center”>
<font face=”Verdana”>
<SELECT name=”HMonth” size=”1″>
<OPTION value=1 selected>Muharram</OPTION>
<OPTION value=2>Shafar</OPTION>
<OPTION value=3>Rabiul Awal</OPTION>
<OPTION value=4>Rabiul Akhir</OPTION>
<OPTION value=5>Jumadil Awal</OPTION>
<OPTION value=6>Jumadil Akhir</OPTION>
<OPTION value=7>Rajab</OPTION>
<OPTION value=8>Syaban</OPTION>
<OPTION value=9>Ramadhan</OPTION>
<OPTION value=10>Syawwal</OPTION>
<OPTION value=11>Dzulqaidah</OPTION>
<OPTION value=12>Dzulhijjah</OPTION>
</SELECT> </font>
</td>
<td height=”35″ bgcolor=”#F6F6F6″ width=”68″ >
<p align=”center”>
<font face=”Verdana”>
<INPUT name=”HYear” size=”6″> </font>
</td></tr>

<tr>
<td colspan=”3″ align=”right” height=”37″ bgcolor=”#F6F6F6″ width=”100%”>
<p align=”center” style=”margin-top: 0; margin-bottom: 0″>
<font face=”Verdana”>
<INPUT onclick=IslToGreg(this.form) type=button value=”Ubah Hijriyah ke Masehi” name=”HtoG” style=”font-weight: bold”>
</font>
</td>
</tr>
</table></center>
</div>
</td></tr>
<tr>
<td align=”center” class=”secondary-header” bordercolor=”#FFFFFF” background=”7.jpg”>
<p style=”margin-top: 0; margin-bottom: 0″><font face=”Verdana”><br>
<b><font color=”#008000″ size=”2″>Jatuh pada hari:</font></b><font color=”#FF0000″>
<INPUT name=”wd” size=”6″ > <INPUT name=”pd” size=”6″ ></font></font></p>
<font face=”Verdana”><span lang=”en-us”>&nbsp;</span><INPUT style=”visibility: hidden” name=”JD” size=”6″ >
</font>
<p style=”margin-top: 0; margin-bottom: 6″>
<font size=”1″ color=”#999999″ face=”Verdana”> <= TRI CAHYA WAHYU M. 11650071 =>

<!–
<INPUT style=”visibility: hidden” name=”JD” size=”20″ >
–>
</font>
<font size=”1″ face=”Verdana” color=”#008000″>&nbsp; </font></font>
<p style=”margin-left:10; margin-right:10; margin-top:0; margin-bottom:20″>
<font size=”1″ face=”Verdana” color=”#FF0000″>Perhitungan pada
sistem konversi ini menggunakan Hisab Urfi sehingga memungkinkan
terjadi selisih H-1 atau H+1 dari tanggal seharusnya.</font></td>
</tr>
</table>
</center>
</div>
<p align=”center” style=”margin-top: 15; margin-bottom: 5″>
<font face=”Verdana”>
<br>
</font></font>
<font face=”Verdana”>
<font style=”font-size: 8pt”>
&nbsp;</font></font><font style=”font-size: 8pt”>

<b>
<span lang=”en-us”><font face=”Verdana”>
</font></span></b>
</p>
</form>

</font><font size=”-1″>
<font size=”-1″>
<SCRIPT language=JavaScript>

function intPart(floatNum){
if (floatNum< -0.0000001){
return Math.ceil(floatNum-0.0000001)
}
return Math.floor(floatNum+0.0000001)
}

function GregToIsl(arg) {

if(gvalidate()==false){
return false
}

d=parseInt(arg.CDay.value)
m=parseInt(arg.CMonth.value)
y=parseInt(arg.CYear.value)
delta=0

if ((y>1582)||((y==1582)&&(m>10))||((y==1582)&&(m==10)&&(d>14)))
{
//added delta=0 on jd to comply isna rulling 2007
jd=intPart((1461*(y+4800+intPart((m-14)/12)))/4)+intPart((367*(m-2-12*(intPart((m-14)/12))))/12)-
intPart( (3* (intPart( (y+4900+ intPart( (m-14)/12) )/100) ) ) /4)+d-32075+delta
}
else
{
//added +1 on jd to comply isna rulling
jd = 367*y-intPart((7*(y+5001+intPart((m-9)/7)))/4)+intPart((275*m)/9)+d+1729777+delta
}
arg.JD.value=jd
//added -1 on jd1 to comply isna rulling
jd1=jd-delta
arg.wd.value=weekDay(jd1%7)
arg.pd.value=pasarDay(jd1%5)
l=jd-1948440+10632
n=intPart((l-1)/10631)
l=l-10631*n+354
j=(intPart((10985-l)/5316))*(intPart((50*l)/17719))+(intPart(l/5670))*(intPart((43*l)/15238))
l=l-(intPart((30-j)/15))*(intPart((17719*j)/50))-(intPart(j/16))*(intPart((15238*j)/43))+29
m=intPart((24*l)/709)
d=l-intPart((709*m)/24)
y=30*n+j-30

arg.HDay.value=d
arg.HMonth.value=m
arg.HYear.value=y
}
function IslToGreg(arg) {

if(hvalidate()==false){
return false
}

d=parseInt(arg.HDay.value)
m=parseInt(arg.HMonth.value)
y=parseInt(arg.HYear.value)
//added – delta=0 on jd to comply isna rulling
jd=intPart((11*y+3)/30)+354*y+30*m-intPart((m-1)/2)+d+1948440-385-delta
arg.JD.value=jd
arg.wd.value=weekDay(jd%7)
arg.pd.value=pasarDay(jd%5)
if (jd> 2299160 )
{
l=jd+68569
n=intPart((4*l)/146097)
l=l-intPart((146097*n+3)/4)
i=intPart((4000*(l+1))/1461001)
l=l-intPart((1461*i)/4)+31
j=intPart((80*l)/2447)
d=l-intPart((2447*j)/80)
l=intPart(j/11)
m=j+2-12*l
y=100*(n-49)+i+l
}
else
{
j=jd+1402
k=intPart((j-1)/1461)
l=j-1461*k
n=intPart((l-1)/365)-intPart(l/1461)
i=l-365*n+30
j=intPart((80*i)/2447)
d=i-intPart((2447*j)/80)
i=intPart(j/11)
m=j+2-12*i
y=4*k+n+i-4716
}

arg.CDay.value=d
arg.CMonth.value=m
arg.CYear.value=y

}
</script>

<script Language=”JavaScript”>
//adji added
var cdays=new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var hdays=new Array(30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29);

function gvalidate()
{
var yleap,d,m,y,m1,m2,m3,leap;
d=document.Hijri.CDay.value;
m=document.Hijri.CMonth.value;
y=document.Hijri.CYear.value;

if(document.Hijri.CYear.value==””)
{
alert(“Gregorian Year can be not empty”);
return false;
document.Hijri.CYear.focus();
}
if(isnumeric(y)==false)
{
alert(“Gregorian Year should be in numerics”)
document.Hijri.CYear.focus();
return false;
}

m1=y%4;
m2=y%100;
m3=y%400;
leap=((m==2)&&((m3==0)||((m1==0)&&(m2!=0))))?1:0;
if(d>(cdays[m-1]+leap))
{
alert(m+”/”+d+”/”+y+” is not a valid Gregorian date.”);
return false;
document.Hijri.CDay.focus();
}

return true;
}
//adji added
</script>
</script>
<script Language=”JavaScript”>
//adji added
var hdays=new Array(30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29);
function hvalidate()
{
var dh,mh,yh,m1h,leaph;
dh=document.Hijri.HDay.value;
mh=document.Hijri.HMonth.value;
yh=document.Hijri.HYear.value;

if(document.Hijri.HYear.value==””)
{
alert(“Tahun harus diisi!!”);
return false;
document.Hijri.HYear.focus();
}

if(isnumeric(yh)==false)
{
alert(“Harus diisi dengan angka!!”)
document.Hijri.HYear.focus();
return false;
}
m1h=yh%30;
//the 2nd, 5th, 7th, 10th, 13th, 16th, 18th, 21st, 24th, 26th, and 29th years are leap years.
leaph=((mh==12)&&(m1h==2||m1h==5||m1h==7||m1h==10||m1h==13||m1h==16||m1h==18||m1h==21||m1h==24||m1h==26||m1h==29))?1:0;
if(dh>(hdays[mh-1]+leaph))
{
alert(mh+”/”+dh+”/”+yh+” Tanggal salah!!”);
return false;
document.Hijri.HDay.focus();
}

return true;
}
//adji added
</script></table></center></div></font></center></td></tr></table></center></div>
</html>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s