I have a method
DateToString(DateTime datetime, string format, CultureInfo cultrueInfo)
{
return datetime.ToString(format, cultureInfo);
}
Parameters:
datetime: {10/1/2016 12:00:00 AM}
format: "ddd, dd MMM"
cultureInfo: {ar-SA}
But it returns me "السبت, 30 ذو الحجة". October 1st is Saturday. Why it seems return me September 30, Saturday? Anything wrong at my side?
ar-SA
culture usesUmAlQuraCalendar
a calendar.Since you used that culture in your
ToString
method, it will generated a string representation based on that calendar. You can't expect to generate "September" since your culture does not useGregorianCalendar
.In
UmAlQuraCalendar
, your DateTiem will be represented as 30-12-1437.https://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm
That's why:
ddd
format specifier generates السبت ((Yawm) as-Sabt aka Saturday) since it is the abbreviated day name.dd
format specifier generates30
as expected.MMM
format specifier generates ذو الحجة (Dhu al-Hijjah) since it is the abbreviated month name.As you can see, abbreviated day and month name switched in result. This is probably a Right to left issue.