Skip to main content

This module allows you to output calendars like the Unix jcal program,

Project description

SolarCalendar or IranianCalendar

This module copy of python calendar moudle but used Solar Hijri calnedar instead Gregorian calendar system and allows you to output calendars like the Unix jcal program, and provides additional useful functions related to the calendar. By default, these calendars have Saturday as the first day of the week, and Friday as the last (the Iranian convention). Use setfirstweekday() to set the first day of the week to Monday (2) or to any other weekday. Parameters that specify dates are given as integers. For related functionality, see also the datetime and time modules.

Example

>>> from solarcalendar import TextSolarCalendar
>>> calendar = TextSolarCalendar()
>>> print(calendar.formatmonth(1399, 10))

      Dey 1399
Sa Su Mo Tu We Th Fr
       1  2  3  4  5
 6  7  8  9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

>>> print(calendar.formatyear(1399))

                                  1399
     Farvardin                Ordibehesht                 Khordad
Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr
                   1             1  2  3  4  5                      1  2
 2  3  4  5  6  7  8       6  7  8  9 10 11 12       3  4  5  6  7  8  9
 9 10 11 12 13 14 15      13 14 15 16 17 18 19      10 11 12 13 14 15 16
16 17 18 19 20 21 22      20 21 22 23 24 25 26      17 18 19 20 21 22 23
23 24 25 26 27 28 29      27 28 29 30 31            24 25 26 27 28 29 30
30 31                                               31
        Tir                      Mordad                  Shahrivar
Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr
    1  2  3  4  5  6                   1  2  3       1  2  3  4  5  6  7
 7  8  9 10 11 12 13       4  5  6  7  8  9 10       8  9 10 11 12 13 14
14 15 16 17 18 19 20      11 12 13 14 15 16 17      15 16 17 18 19 20 21
21 22 23 24 25 26 27      18 19 20 21 22 23 24      22 23 24 25 26 27 28
28 29 30 31               25 26 27 28 29 30 31      29 30 31
        Mehr                      Aban                      Azar
Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr
          1  2  3  4                      1  2       1  2  3  4  5  6  7
 5  6  7  8  9 10 11       3  4  5  6  7  8  9       8  9 10 11 12 13 14
12 13 14 15 16 17 18      10 11 12 13 14 15 16      15 16 17 18 19 20 21
19 20 21 22 23 24 25      17 18 19 20 21 22 23      22 23 24 25 26 27 28
26 27 28 29 30            24 25 26 27 28 29 30      29 30
        Dey                      Bahman                    Esfand
Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr      Sa Su Mo Tu We Th Fr
       1  2  3  4  5                   1  2  3                         1
 6  7  8  9 10 11 12       4  5  6  7  8  9 10       2  3  4  5  6  7  8
13 14 15 16 17 18 19      11 12 13 14 15 16 17       9 10 11 12 13 14 15
20 21 22 23 24 25 26      18 19 20 21 22 23 24      16 17 18 19 20 21 22
27 28 29 30               25 26 27 28 29 30         23 24 25 26 27 28 29
                                                    30

About SolarCalendar

From wikipedia , the Solar Hijri calendar (Persian: گاه‌شماری هجری خورشیدی, romanized: gāhshomāri-ye hejri-ye khorshidi; Pashto: لمريز لېږدیز کلیز), also called the Iranian Hijri calendar or Shamsi Hijri calendar, and abbreviated as SH and, sometimes, HS, is the official calendar of Iran and Afghanistan. It begins on the March equinox (Nowruz) as determined by astronomical calculation for the Iran Standard Time meridian (52.5°E, UTC+03:30) and has years of 365 or 366 days.

Its determination of the start of each year is astronomically accurate year-to-year as opposed to the more fixed Gregorian or Common Era calendar which, averaged out, has the same year length, achieving the same accuracy (a more simply patterned calendar of 365 days for three consecutive years plus an extra day in the next year, save for exceptions to the latter in three out of every four centuries). The start of the year and its number of days remain fixed to one of the two equinoxes, the astronomically important days when day and night each have the same duration. It results in less variability of all celestial bodies when comparing a specific calendar date from one year to others.

Each of the twelve months corresponds with a zodiac sign. The first six months have 31 days, the next five have 30 days, and the last month has 29 days in usual years but 30 days in leap years. The Iranian New Year's Day always falls on the March equinox.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SolarCalendar-0.1.1.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SolarCalendar-0.1.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file SolarCalendar-0.1.1.tar.gz.

File metadata

  • Download URL: SolarCalendar-0.1.1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for SolarCalendar-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f2057d409c11450a257249b6af6ceab6280dae3ca5fef3e7a131bf72cf6ced6a
MD5 ef68366414bc2bc23d49ac189d579fbf
BLAKE2b-256 18b3dbd8e86c4d4fb11e5ddcfa5133f2b60e7b83cf022925a608408b10e31333

See more details on using hashes here.

File details

Details for the file SolarCalendar-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: SolarCalendar-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for SolarCalendar-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60028a8eaff1d923fcf5d7520f1693b47f8611edbd133c1171021bb1548f74f7
MD5 abb027d926540f9ad3488c7f39b59442
BLAKE2b-256 ecb032c83983c43b9be23cab9cf436c645d67e73f53a415a93d98fa916620acb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page