I want to get datetime from user in windows form C#.net .I use datetimepicker of .net control but it is gregorian so how can I change This datetimepicker to shamsi date???
Asked
Active
Viewed 9,692 times
7

saba
- 107
- 2
- 5
-
Have a look at this [PersianDateTimePicker, PersianMonthCalendar](http://persiancontrol.codeplex.com/) – Salah Akbari Oct 18 '16 at 19:03
-
1Possible duplicate of [this post](http://stackoverflow.com/questions/23797234/persian-raddatetimepicker-in-c-sharp-winform) – Hank Oct 18 '16 at 20:55
-
2There is an open source library created by [@Hadi Eskandari](http://stackoverflow.com/users/54538/hadi-eskandari). Here is the link for [codeproject article](http://seesharpsoftware.com.au/farsilibrary-v2.6-now-available/), [page of the library](http://seesharpsoftware.com.au/farsilibrary-v2.6-now-available/) in his site and the [nuget package](https://www.nuget.org/packages/Farsi.Library/). The library is called FarsiLibrary but its DateTimePicker and MonthView supports Jalali (Shamsi / Persian), Hijri (Qamari / Islamic) and Gregorian. – Reza Aghaei Oct 18 '16 at 22:23
2 Answers
1
Previously I tried Behrooz Moghaddam's code but using the default winforms DateTimePicker control, but that code didn't work.
Now I am using the telerik RadDateTimePicker
and write this code after InitializeComponent()
and instead of "fa-IR"
use your culture.
Application.CurrentCulture = new CultureInfo("fa-IR");
radDateTimePicker1.Format = DateTimePickerFormat.Custom;
radDateTimePicker1.CustomFormat = Application.CurrentCulture.DateTimeFormat.ShortDatePattern;
-1
No need for an additional library. You can change the calander type in Region Setting on the control panel.
And add these lines after InitializeComponent();
Application.CurrentCulture = new CultureInfo("fa-IR");
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = Application.CurrentCulture.DateTimeFormat.ShortDatePattern;

HeadhunterKev
- 1,728
- 5
- 13

Behrooz Moghaddam
- 105
- 1
- 4