( تعداد نمایش : 1854 )

تاریخ شمسی در جاوا اسکریپت

با استفاده از این کد میتوانید تاریخ شمسی را در وب سایت خود درج نمایید نکته قابل توجه این است که تاریخ شمسی بر طبق تاریخ سیستم کاربر تعیین می گردد.

<script language=”javascript” type=”text/javascript”>
dayName = new Array (“ÙŠÚ© شنبه “,” دوشنبه”,” سه شنبه “,” چهار شنبه “,” پنجشنبه “,” جمعه “,” شنبه” )
monName = new Array ( “دي”,”بهمن”,”اسفند”,”فروردين”,”ارديبهشت”,”خرداد”,”تير”,”مرداد”,”شهريور”,”مهر”,”آبان”,”آذر”)
now = new Date
</script>
<script language=”javascript”>
rr=dayName[now.getDay()]
if (now.getMonth() <= 1 ) { ii=now.getFullYear()-622 } else { if ( now.getDate() <= 21 && now.getMonth() == 2) { ii=now.getFullYear()-622 } else { ii=now.getFullYear()-621 }}
</script>
<script language=”javascript” type=”text/javascript”>
if ( now.getMonth() == 6 || now.getMonth() == 7 || now.getMonth() == 8 || now.getMonth() == 9) { if ( now.getDate() <=22 ) { mm=monName[now.getMonth()] } else {mm=monName[now.getMonth()+1]}}
if ( now.getMonth() == 4 || now.getMonth() == 5 || now.getMonth() == 10 ) { if ( now.getDate() <=21 ) { mm=monName[now.getMonth()] } else {mm=monName[now.getMonth()+1] }}
if ( now.getMonth() == 0 || now.getMonth() == 2 || now.getMonth() == 3 ) { if ( now.getDate() <=20 ) { mm=monName[now.getMonth()] } else { mm=monName[now.getMonth()+1] }}
if ( now.getMonth() == 1) { if ( now.getDate() <=19 ) { mm=monName[now.getMonth()] } else { mm=monName[now.getMonth()+1] }}
if ( now.getMonth() == 11) { if ( now.getDate() <=21 ) { mm=monName[now.getMonth()] } else { mm=monName[now.getMonth()-11] }}
if ( now.getMonth() == 2 || now.getMonth() == 3 || now.getMonth() == 0 ){if ( now.getDate() <=20 ) {mr=now.getDate()+10 } else {  mr=now.getDate()+10-30 }}
if ( now.getMonth() == 4 || now.getMonth() == 5 ){ if ( now.getDate() <=21 ) { mr=now.getDate()+10 } else { mr=now.getDate()+10-31 }}
if ( now.getMonth() == 6 || now.getMonth() == 7 || now.getMonth() == 8 ){ if ( now.getDate() <=21 ) { mr=now.getDate()+9 } else { mr=now.getDate()+9-31 }}
if ( now.getMonth() == 10 || now.getMonth() == 11){ if ( now.getDate() <=21 ) { mr=now.getDate()+9 } else { mr=now.getDate()+9-30 }}
if ( now.getMonth() == 9){ if ( now.getDate() <=22 ) { mr=now.getDate()+8 } else { mr=now.getDate()+8-30} }
if ( now.getMonth() == 1 ){ if ( now.getDate() <=20 ) { mr=now.getDate()+11 } else { mr=now.getDate()+11-30  }}
document.write(“<font face=’Tahoma’ size=’2′ color=’#FF0000′>” + rr + “, ” +mr+” “+ mm + ” ” + ii + “</font>”)
</script></font>

دیدگاه خود را بیان کنید.

باید وارد سایت شده باشید برای دیدگاه دادن