if i convert the below Arabic date to English then i will face an exception(String was not recognized as a valid DateTime) .Please suggest if any solution for this.
If i am doing same in google converter then i got the answer in google is: 27 January, 2009 Tuesday
But i want to do in c# coding can you please help me??
arabic date formate is : (1430/01/30 yyyy/mm/dd)
What I have tried:
private void ConvertArabicDate()
{
string strArabicDate="14300130";
string engDate = string.Empty;
CultureInfo arCul = new CultureInfo("ar-SA");
CultureInfo enCul = new CultureInfo("en-US");
string[] allFormats = { "yyyy/MM/dd", "yyyy/M/d", "dd/MM/yyyy", "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "yyyy-MM-dd", "yyyy-M-d", "dd-MM-yyyy", "d-M-yyyy", "dd-M-yyyy", "d-MM-yyyy", "yyyy MM dd", "yyyy M d", "dd MM yyyy", "d M yyyy", "dd M yyyy", "d MM yyyy" };
try
{
DateTime tempDate = DateTime.ParseExact(strArabicDate, allFormats, arCul.DateTimeFormat, DateTimeStyles.AllowWhiteSpaces);
engDate = tempDate.ToString("dd-MMM-yyyy", enCul.DateTimeFormat);
}
catch (Exception ex)
{
engDate = "Unable to convert Arabic date ";
}
}