- Notifications
You must be signed in to change notification settings - Fork0
A free software for Jalali and shamsi date to get current date in jalali calendar.
License
BaseMax/jdate
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A free software for Jalali and shamsi date to get current date in jalali calendar.
- Convert date to jalali, shamsi calendar and getting current date
- Getting name of days (day of week)
- Getting name of months
1399/1/3 - فروردين - يکشنبه
1399/1/3 - فروردين - يکشنبه
$ cd src/$ gcc jdate.c -o jdate -O3$ move jdate /usr/bin/
It will use$ date
if you pass--auto
argument.
The Persian calendar is a solar calendar with a starting point that matches that of the Islamiccalendar. Apart from that, the two calendars are not related. The origin of the Persian calendar canbe traced back to the 11th century when a group of astronomers (including the well-known poet OmarKhayyam, pictured above) created what is known as the Jalaali calendar. However, a number of changes have been madeto the calendar since then.
The current calendar has been used in Iran since 1925 and in Afghanistan since 1957. However,Afghanistan used the Islamic calendar in the years 1999-2002.
The names and lengths of the 12 months that comprise the Persian year are:
1. | Farvardin | (31 days) | 7. | Mehr | (30 days) |
2. | Ordibehesht | (31 days) | 8. | Aban | (30 days) |
3. | Khordad | (31 days) | 9. | Azar | (30 days) |
4. | Tir | (31 days) | 10. | Day | (30 days) |
5. | Mordad | (31 days) | 11. | Bahman | (30 days) |
6. | Shahrivar | (31 days) | 12. | Esfand | (29/30 days) |
(Due to different transliterations of the Persian alphabet, other spellings of the months arepossible.) In Afghanistan the months are named differently.
The month of Esfand has 29 days in an ordinary year, 30 days in a leap year.
The Persian year starts at vernal equinox. If the astronomical vernal equinox falls before noon(Tehran true time) on a particular day, then that day is the first day of the year. If theastronomical vernal equinox falls after noon, the following day is the first day of the year.
As in the Islamic calendar, years are counted sinceMohammed’semigration to Medina in AD 622. At vernal equinox of that year, AP 1 started (AP =Anno Persico/Anno Persarum = Persian year).
Note that contrary to the Islamic calendar, the Persian calendar counts solar years. In the yearAD 2011 we have therefore witnessed the start of Persian year 1390, but the start of Islamicyear 1432.
Since the Persian year is defined by the astronomical vernal equinox, the answer is simply: Leapyears are years in which there are 366 days between two Persian new year’s days.
However, basing the Persian calendar purely on an astronomical observation of the vernal equinoxis rejected by many, and a few mathematical rules for determining the length of the year have beensuggested.
The most popular (and complex) of these is probably the following:
The calendar is divided into periods of 2820 years. These periods arethen divided into 88 cycles whose lengths follow this pattern:
29, 33, 33, 33, 29, 33, 33, 33, 29, 33, 33, 33, ...
This gives 2816 years. The total of 2820 years is achieved by extending the last cycle by 4 years(for a total of 37 years).
If you number the years within each cycle starting with 0, then leap years are the years that aredivisible by 4, except that the year 0 is not a leap year.
So within, say, a 29 year cycle, this is the leap year pattern:
Year | Type | Year | Type | Year | Type | Year | Type |
---|---|---|---|---|---|---|---|
0 | Ordinary | 8 | Leap | 16 | Leap | 24 | Leap |
1 | Ordinary | 9 | Ordinary | 17 | Ordinary | 25 | Ordinary |
2 | Ordinary | 10 | Ordinary | 18 | Ordinary | 26 | Ordinary |
3 | Ordinary | 11 | Ordinary | 19 | Ordinary | 27 | Ordinary |
4 | Leap | 12 | Leap | 20 | Leap | 28 | Leap |
5 | Ordinary | 13 | Ordinary | 21 | Ordinary | ||
6 | Ordinary | 14 | Ordinary | 22 | Ordinary | ||
7 | Ordinary | 15 | Ordinary | 23 | Ordinary |
This gives a total of 683 leap years every 2820 years, which corresponds to an average yearlength of 365 683/2820 = 365.24220 days. This is a better approximation to thetropical year than the 365.2425 days of the Gregorian calendar.
The current 2820 year period started in the year AP 475 (AD 1096).
This “mathematical” calendar currently coincides closely with the purely astronomicalcalendar. In the years between AP 1244 and 1531 (AD 1865 and 2152) a discrepancy of oneday is seen twice, namely in AP 1404 and 1437 (starting at vernal equinox of AD 2025 and2058). However, outside this period, discrepancies are more frequent.
My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)
A team includes some programmer, developer, designer, researcher(s) especially Max Base.
About
A free software for Jalali and shamsi date to get current date in jalali calendar.