How do you convert Gregorian dates to Islamic Hijri dates using JavaScript?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
This converts current computer date to hijri. And with a little modification you can achieve that this snippet change any date to islamic
Taken from This site
If you need only the year of Hijri date converted from Gregorian date (Miladi date) you can simply write this equation in javascript:
you can use this simple equation in the footer in master page like كل الحقوق محفوطة لـ ... ©
you will get: كل الحقوق محفوطة لـ ... © 2014 م - 1435 هـ
you can also use C# embedded in asp page as:
will return : 2014 - 1436
Finally, if you need to convert to UmAlQura date, simply try this line of code:
will return : ٧/١١/١٤٤٠ هـ
Checkout my library hijrah-date which is a Javascript date in the Hijrah calendar system.
It also supports Hijrah to Gregorian and Gregorian to Hijrah conversion. In addition to date formatting.