Expand description
Shahanshahi (Imperial Persian) to Gregorian date conversion. Shahanshahi (Imperial Persian) calendar conversion.
The Shahanshahi calendar uses the same months and leap year rules as the Solar Hijri (Jalali) calendar, but counts years from the founding of the Persian Empire by Cyrus the Great. The year offset is +1180 relative to Jalali (e.g. Jalali 1404 = Shahanshahi 2584).
Internally, conversion to/from Gregorian uses the Jalali algorithm with the offset applied at the public API boundary.
Functions§
- days_
in_ month - Get the number of days in a given Shahanshahi month.
- gregorian_
to_ shahanshahi - Convert a Gregorian date to Shahanshahi date. Returns (year, month, day) where month is 1-based.
- is_leap
- Check if a Shahanshahi year is a leap year. Uses the 33-year sub-cycle on the underlying Jalali year.
- shahanshahi_
to_ gregorian - Convert a Shahanshahi date to Gregorian. Returns (year, month, day).
- today
- Get today’s date in the Shahanshahi calendar.
- weekday_
of_ first - Get the weekday of the first day of a Shahanshahi month. Returns 0=Saturday, 1=Sunday, …, 6=Friday (Iranian week).