1
Hi,
Refer the following link.
https://www.codeproject.com/Articles/334820/Using-Globalization-and-Localization-in-ASP-NET
1
Hai Nawaz ,
Refer the following Link : https://msdn.microsoft.com/en-us/library/az4se3k1(v=VS.90).aspx
toString() method accepts a format provider. So have like this
- DateTimeFormatInfo info=CultureInfo.CurrentCulture.DateTimeFormat;
- DateTime.Now.Day.ToString(info);
1
thankyou guys for your reply !
i just changed "ar-SA" to "ar-BH" and problem is solved. date only gets changed with "ar-SA" by all others like "ar-AE" and other it's not get changed
1
Please refer the link for detailed explanation:https://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx
1
Try wih below code:
- public static string ConvertDateCalendar(DateTime DateConv, string Calendar, string DateLangCulture)
- {
- DateTimeFormatInfo DTFormat;
- DateLangCulture = DateLangCulture.ToLower();
-
-
- if (Calendar == "Hijri" && DateLangCulture.StartsWith("en-"))
- {
- DateLangCulture = "ar-sa";
- }
-
-
- DTFormat = new System.Globalization.CultureInfo(DateLangCulture, false).DateTimeFormat;
-
-
- switch (Calendar)
- {
- case "Hijri":
- DTFormat.Calendar = new System.Globalization.HijriCalendar();
- break;
-
- case "Gregorian":
- DTFormat.Calendar = new System.Globalization.GregorianCalendar();
- break;
-
- default:
- return "";
- }
-
-
- DTFormat.ShortDatePattern = "dd/MM/yyyy";
- return (DateConv.Date.ToString("f", DTFormat));
- }
-
- DateTime dtq = new DateTime(2017, 08, 21);
- string date = ConvertDateCalendar(dtq, "Hijri", "en-US");
Follow below link, that may help you:
http://www.c-sharpcorner.com/blogs/arabic-calendar-date-to-english-calendar-date-in-windows-form-c-sharp1