Click here to Skip to main content
6,822,123 members and growing! (18,827 online)
Email Password   helpLost your password?
Languages » C# » Date / Time     Intermediate License: The Code Project Open License (CPOL)

Persian DateTime

By Mohammad Mir mostafa

A structure like System.DateTime which is designed to support Persian calendar
C# (C#3.0, C#4.0), Windows (Win2K, WinXP, Win2003, Vista, Win2008, Win7, Win2008-R2), .NET (.NET3.5, .NET4.0), Visual-Studio (VS2008), Architect, Dev
Revision:4 (See All)
Posted:3 Feb 2007
Updated:16 Nov 2009
Views:11,488
Bookmarked:15 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
9 votes for this article.
Popularity: 2.08 Rating: 2.18 out of 5
5 votes, 55.6%
1

2

3

4
4 votes, 44.4%
5

Introduction

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 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.

Background

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 instantiately. I mean you can use it with/without an instance:

Console.WriteLine(PersianDateTime.Now);

or:

PersianDateTime persianDateTime = new PersianDateTime(DateTime.Now);

License

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


Member

Occupation: Product Manager
Company: Pasargad
Location: Iran (Islamic Republic Of) Iran (Islamic Republic Of)

Other popular C# articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
GeneralBut PinmemberMember 67145010:56 15 Nov '09  
GeneralRe: But PinmemberMohammad Mir mostafa3:34 16 Nov '09  
Generaltank you Pinmembers_ahmadneya2:03 30 Dec '08  
GeneralThank You PinmemberMember 193372921:40 19 Sep '08  
GeneralThanks PinmemberB.Farivar0:54 9 Jul '08  
GeneralC sharp Code Generator PinmemberHemant.Kamalakar5:34 19 Sep '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

PermaLink | Privacy | Terms of Use
Last Updated: 16 Nov 2009
Editor: Deeksha Shenoy
Copyright 2007 by Mohammad Mir mostafa
Everything else Copyright © CodeProject, 1999-2010
Web21 | Advertise on the Code Project