asp.netvb.netarabicdate-formatdatetimeformatinfo

Arabic date displaying incorrectly


I'm using the following code to display an arabic date:

Dim dtFormat As DateTimeFormatInfo = New CultureInfo("ar-sa", False).DateTimeFormat
dtFormat.Calendar = New HijriCalendar()

Dim hijriDate As String = Now.ToString("d MMMM yyyy", dtFormat)

Today this is displaying as 16 ربيع الثاني 1432. However, according to a user, the arabic text should be in the middle with the year 1432 at the end.

However, when you highlight the text, it highlights back to front.

What am I doing wrong?


Solution

  • This is a known problem with "right to left" Arabic text when it gets mixed in with numbers. How are you displaying it? If you are using a windows control make sure that the RightToLeft property is set to true. If it's web; use css style direction:rtl;