Reputation: 655
i have a column in my database that stores DateTime, now i want to show time in simple format,
you know it will appear like : 12/26/2011 9:39:55 PM
but i want to show it in persian.
Upvotes: 1
Views: 378
Reputation: 58753
Have a look at the examples on MSDN for using the PersianCalendar class.
var cal = new PersianCalendar();
var today = DateTime.Now;
var persianDate = string.Format("{0}/{1}/{2}",
cal.GetDayOfMonth(today),
cal.GetMonth(today),
cal.GetYear(today));
Upvotes: 1
Reputation: 499132
When you want to format the DateTime
in your application, you need to use a DateTime.ToString
overload.
Select the appropriate standard Date and Time format string - in this case "g"
looks like a good fit.
If you have not set up your webserver to use the fa-IR
culture by default, you will need to pass this culture in as well.
string farsiDate = myDateTime.ToString("g", CultureInfo.GetCultureInfo("fa-IR");
Upvotes: 0