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

Persian DateTime

, 25 Apr 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
A structure like System.DateTime which is designed to support Persian calendar


After a long time, I updated this article again. (Happy!!!)

Since the time I can remember, lack of a class or struct to support Persian calendar in programming languages was one of my big problems. Up to the language I was using, I tried to solve this problem with different solutions. But none of them is an absolute solution.

This problem was almost solved in .NET 2.0 by a class named PersianCalendar, but it was not the complete way. So I decided to create a class like System.DateTime.


PersianDateTime is a very simple struct which gives us simple support for Persian DateTime. I'm trying to develop and update it. Therefore it would be great if you leave your suggestions to help me complete it.

Using the Code

A few examples can be found in the source code.

PersianDateTime can be used in two ways: Staticly and instanciately. I mean you can use it with/without an instance:



PersianDateTime persianDateTime = new PersianDateTime(DateTime.Now);


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


About the Author

Mohammad Mir mostafa
Architect Iran
Iran (Islamic Republic Of) Iran (Islamic Republic Of)
No Biography provided

Comments and Discussions

Questionnice! Pinmemberablackeshvari1-May-14 1:21 
QuestionHow to use it in project PinmemberMajid Basirati1-Aug-13 11:58 
AnswerRe: How to use it in project PinmemberMohammad Dayyan27-Dec-14 21:00 
Questionshamsi Date to miladi PinmemberMarziyeh Eslampanah20-Oct-12 1:16 
can any one help me about a Conversion of Shamsi date to Miladi?
i need a dll.I kmow that VS2010 has that but isnot work exact Frown | :( :(
AnswerRe: shamsi Date to miladi PinmemberMohammad Dayyan3-Jan-15 19:48 
QuestionSuggestion: Please use better names! PinmemberFlomenol7-Apr-12 4:20 
AnswerRe: Suggestion: Please use better names! PinmemberMohammad Mir mostafa9-Apr-12 0:23 
QuestionCode Usage PinmemberMember 827970830-Sep-11 10:53 
AnswerRe: Code Usage PinmemberMohammad Dayyan3-Jan-15 19:50 
Questionthankful for you Pinmemberamir 21-Aug-11 23:10 
Generalhi Pinmemberraha_45524-Feb-11 3:53 
GeneralMy vote of 5 PinmemberSayyeid Mostafa Hashemi21-Dec-10 4:50 
GeneralMonth names PinmemberKamranBehzad14-Jun-10 20:01 
GeneralRe: Month names PinmemberMohammad Mir mostafa15-Jun-10 0:37 
GeneralAddDays Pinmembershervin12-Mar-10 19:20 
GeneralRe: AddDays PinmemberMohammad Dayyan3-Jan-15 19:51 
GeneralBut PinmemberMember 671450115-Nov-09 0:56 
GeneralRe: But PinmemberMohammad Mir mostafa16-Nov-09 3:34 
Generaltank you Pinmembers_ahmadneya30-Dec-08 2:03 
GeneralThank You PinmemberMember 193372919-Sep-08 21:40 
GeneralThanks PinmemberB.Farivar9-Jul-08 0:54 
GeneralC sharp Code Generator PinmemberHemant.Kamalakar19-Sep-07 5:34 

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
Web03 | 2.8.150414.1 | Last Updated 25 Apr 2011
Article Copyright 2007 by Mohammad Mir mostafa
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid