Академический Документы
Профессиональный Документы
Культура Документы
Questions
Tags
Users
sign up
Badges
Unanswered
log in
Ask
javascript
date
gregorian-calendar
date-conversion
hijri
Does anyone know how to convert from Gregorian date to the Islamic Hijri date using JavaScript?
share
1 1 5
Amro
97.9k
2 Answers
17 147 283
Asked
Mar 3 '11 at 6:51
Edited
Jun 9 '12 at 21:36
order by votes
This converts current computer date to hijri. And with a little modification you can achieve that this snippet change any date to
islamic
document.write(writeIslamicDate(1));
share
10 24
thank you for the fast reply, i will try and use this function.. =D FuNk Mar 3 '11 at 7:21
guess what, it really work.. thank you again.. =D FuNk Mar 3 '11 at 7:23
Answered
Mar 3 '11 at 7:07
Excellent, can you please tell me what this adjustment / adjust variable is used for?? AtanuCSE Jun 19 '14 at 5:19
"Adjust" variable is used to correct the shift in Hijri dates which occurs because of variable moon status and visibility on different months. Ahmed Said Apr 1 '15
at 13:41
add a comment
If you need only the year of Hijri date converted from Gregorian date (Miladi date) you can simply write this equation in javascript:
var GregorianYear = (new Date()).getFullYear();
var HijriYear = Math.round((GregorianYear - 622) * (33 / 32));
you can use this simple equation in the footer in master page like ...
<script type="text/javascript">document.write((new Date()).getFullYear())</script> - <script type="text/javascript">var y = (new Date()).getFullYear();
var h = Math.round((y - 622) * (33 / 32));document.write(h)</script>
share
11
Answered
Aug 8 '14 at 15:49
Edited
Nov 15 '14 at 13:01
Your Answer
log in
or
Name
By posting your answer, you agree to the privacy policy and terms of service.
meta chat tour help blog privacy policy legal contact us full site
Download the Stack Exchange Android app
2016 Stack Exchange, Inc