Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Why Hijri Date Conversion Breaks Naive Math Formulas

If you search "convert Gregorian to Hijri" you'll find dozens of one-line formulas floating around StackOverflow, most of them some variant of hijriYear = (gregorianYear - 622) * 33 / 32. They compile, they run, and they're wrong more…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

If you search "convert Gregorian to Hijri" you'll find dozens of one-line formulas floating around StackOverflow, most of them some variant of hijriYear = (gregorianYear - 622) * 33 / 32. They compile, they run, and they're wrong more often than they're right. Here's why, and what a correct implementation actually needs to account for.






The core problem: Hijri is observational, not purely arithmetic



The Gregorian calendar is a fixed solar calendar: every year is either 365 or 366 days, decided by a simple leap-year rule. The Hijri calendar is lunar, and a lunar month is roughly 29.53 days. That means a Hijri year runs about 354 or 355 days, roughly 10-11 days shorter than a Gregorian year.



A linear ratio formula assumes that gap grows at a constant rate. It doesn't. Two people born in the same Gregorian year can land in different Hijri years depending on which month and day they were born, because the drift accumulates unevenly across the year, not proportionally.






Why "tabular" Islamic calendars aren't the same as Umm al-Qura



There are actually multiple standardized Hijri calendar systems. Some countries use a "tabular" Islamic calendar with a fixed 30-year leap cycle (11 leap years out of 30), which is arithmetically predictable. Saudi Arabia's official calendar, Umm al-Qura, is based on astronomical calculations of lunar visibility, and its month lengths don't always match the tabular system.



This matters a lot if you're building anything that needs to be accurate for Saudi users specifically: government paperwork, religious dates, retirement age calculations, school enrollment cutoffs. A generic tabular-calendar library will silently disagree with the real Umm al-Qura calendar on certain dates, sometimes by a full day, which shifts the reported Hijri date entirely.






What an accurate implementation actually needs




  1. A proper day-count conversion (Julian Day Number as the intermediate step) instead of a year-level ratio

  2. Support for the specific Hijri variant you need (tabular vs Umm al-Qura), since they diverge

  3. Testing against known reference dates, not just internal consistency



I ended up building this into a small web tool rather than reinventing it for every project. If you want to see it in action, there's a free Hijri-Gregorian date converter that does the Julian Day Number conversion under the hood and follows the official Umm al-Qura calendar, plus an age calculator that handles the Hijri/Gregorian gap correctly instead of using the flawed ratio shortcut.



If you're implementing this yourself, the short version is: don't multiply, count days.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Why Hijri Date Conversion Breaks Naive Math Formulas

Thematisch verwandte Begriffe: Hijri, Date, Conversion, Breaks · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94030 | A security vulnerability has been detected in SerenityOS up to 3d83e4509…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick