Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The CultureInfo class will not help you in either parsing or formatting the numbers to eastern Arabic ("٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩") nor to western Arabic ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"). You have to manually convert it, Here is a little function which will do that for you in a neat way:</p> <pre><code>public string ConvertToEasternArabicNumerals(string input) { System.Text.UTF8Encoding utf8Encoder = new UTF8Encoding(); System.Text.Decoder utf8Decoder = utf8Encoder.GetDecoder(); System.Text.StringBuilder convertedChars = new System.Text.StringBuilder(); char[] convertedChar = new char[1]; byte[] bytes = new byte[] { 217, 160 }; char[] inputCharArray = input.ToCharArray(); foreach (char c in inputCharArray) { if (char.IsDigit(c)) { bytes[1] = Convert.ToByte(160 + char.GetNumericValue(c)); utf8Decoder.GetChars(bytes, 0, 2, convertedChar, 0); convertedChars.Append(convertedChar[0]); } else { convertedChars.Append(c); } } return convertedChars.ToString(); } </code></pre> <p>Now alter your code a little to look like this:</p> <pre><code>string sDate DateTime dtt = Convert.ToDateTime("19/01/2012"); CultureInfo ci = new CultureInfo("ar-SA"); sDate = ConvertToEasternArabicNumerals(dtt.ToString("dd/MM/yyyy", ci)); </code></pre> <p>And things will work just fine. BTW, the code for the function was taken from <a href="http://weblogs.asp.net/abdullaabdelhaq/archive/2009/06/27/displaying-arabic-number.aspx" rel="noreferrer">here</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload