This project is read-only.

This project contains a class named PersianDateTime which persian developers can use instead of System.DateTime structure. This class also contains most of the methods and properties of the conventional DateTime structure such as DateTime.Now and DateTime.TimeOfDay.

To install PersianDateTime, run the following command in the Package Manager Console

PM> Install-Package PersianDateTime



PersianDateTime now = PersianDateTime.Now;

string persianDateTime = now.ToString(); // 1392/03/09 23:37:57 string persianDate = now.ToString(PersianDateTimeFormat.Date); // 1392/03/09 string persianFullDateTime = now.ToString("dddd d MMMM yyyy ساعت hh:mm:ss tt"); // پنج شنبه 9 خرداد 1392 ساعت 11:37:57 ب.ظ TimeSpan persianTime = now.TimeOfDay; // 23:37:57.4641984


PersianDateTime persianDate = PersianDateTime.Parse("1392/03/02");
DateTime miladiDate = persianDate.ToDateTime();

PersianDateTime newDate = persianDate.AddDays(5);
TimeSpan time = newDate - persianDate;

Last edited May 31, 2013 at 7:44 AM by rahmatrezaei, version 11