Click here to Skip to main content
Click here to Skip to main content

Persian Calendar and Date Picker for Web Applications (JavaScript)

, 27 Nov 2007 CPOL
Rate this:
Please Sign up or sign in to vote.
A library to work with "Persian Calendar", "Hijri Calendar", "Jalali Calendar", and "Gregorian Calendar" with WebForms GUI controls designed for Persian (Farsi) or Arabic language applications in mind, but usable in any web application that makes use of a calendar.

Sample Image - Persian_Date_Picker.jpg


The Persian Calendar is used in most countries where Persian is spoken, although some regions use different month names. The Persian calendar is the official calendar of Iran and Afghanistan, and is one of the alternative calendars in regions such as Kazakhstan and Tajikistan. The Persian calendar is based on a solar year, and is approximately 365 days long. A year cycles through four seasons, and a new year begins when the sun appears to cross the equator from the southern hemisphere to the northern hemisphere as viewed from the center of the Earth. The new year marks the first day of the month of Farvardin, which is the first day of spring in the northern hemisphere. Each of the first six months in the Persian calendar has 31 days, each of the next five months has 30 days, and the last month has 29 days in a common year and 30 days in a leap year. A leap year is a year that, when divided by 33, has a remainder of 1, 5, 9, 13, 17, 22, 26, or 30. For example, the year 1370 is a leap year because dividing it by 33 yields a remainder of 17. There are approximately 8 leap years in every 33-year cycle.

Using the code

This example demonstrates how to use the Persian Calendar. You should add the required references to the head section of your page:

<script type="text/javascript" language="JavaScript" src="JScripts/amin.js">
<script type="text/javascript" language="JavaScript" src="JScripts/calendar.js">
<link rel="stylesheet" type="text/css" href="CSS/calendar.css">

And call the 'displayDatePicker' function where you want the calendar to appear:

<form style="text-align:center ">
  <input name="AnotherDate">
  <input value="select" onclick="displayDatePicker('AnotherDate', this);" type="button">


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Amin Habibi S.
Web Developer
Iran (Islamic Republic Of) Iran (Islamic Republic Of)
I was born in Gonabad (1984).
I spent there my whole life until I was accepted in national university entrance exam. Then I migrated to Tehran.
Now I live in Tehran

You can see my CV at:

Comments and Discussions

Suggestionتولید user control PinmemberHadi Zaker13-Oct-14 12:15 
Questionتشکر Pinmembermonanini25-Feb-14 1:14 
Questionایمیل Pinmemberabollfazl8-Jun-13 4:29 
GeneralMy vote of 5 PinmemberArash Farahani1-Apr-13 5:54 
Questionسلام Pinmemberabollfazl9-Jan-13 23:36 
Generalمرسی Pinmembere.rabiei6825-Aug-12 20:52 
Questiontanks Pinmembers_ahmadneya18-Feb-12 4:01 
Questionwow this nice Pinmemberjavad1121184-Feb-12 2:58 
Questiontnx Pinmemberqazale7-Sep-11 4:33 
Questionthanks Pinmembercomputec_teh2-Jul-11 1:15 
Generalthx Pinmembernasrin647-Jun-11 21:14 
GeneralMy vote of 5 PinmemberMohammad Dayyan5-Jun-11 5:14 
Generaljsf PinmemberMorteza Davoodi1-Jun-11 2:17 
GeneralMy vote of 5 PinmemberShahin Khorshidnia3-Apr-11 19:36 
GeneralPersianCalendar conflict PinmemberM.M.Rezaee23-Sep-10 11:01 
همانطوریکه میدونید یک کلاس به همین نام در ورژن دو به بالا هست، گمان میکنم اگر در ورژن بعدی اسم کلاستون را عوض کنید بهتر باشد چون در صورت استفاده از کلاس موجود برنامه نویس مجبور میشود اسم و مسیر کامل کلاس را بنویسد

با تشکر از زحمات شما
GeneralMy vote of 5 Pinmembergh_shahabi8-Aug-10 4:06 
GeneralpersianCanelndar Pinmembercamelia11125-Jul-10 1:21 
GeneralNice work. PinmemberReza Jahanbakhshi21-Apr-10 19:31 
Generalسلام Pinmemberali_mahdi29-Sep-09 6:43 
GeneralHi Pinmemberali_mahdi29-Sep-09 6:38 
QuestionHow can i prevent user to modify the choosen date from date picker? Pinmemberhoney.hv13-Jul-09 3:13 
GeneralGreat work but bad js code Pinmemberarash alavi20-May-09 22:25 
GeneralThank you PinmemberJinousa7-Mar-09 4:38 
Generalabout Hijri Calender Pinmemberibless26-Aug-08 6:09 
GeneralThanks Pinmembershahrzad khorrami12-May-08 1:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.1 | Last Updated 28 Nov 2007
Article Copyright 2007 by Amin Habibi S.
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid