title: converting string to a special kind of variable
body: <p>I need to use strvalue instead of value in</p>
  
  <pre><code>  var date = (DateTime)value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture);  
  </code></pre>
  
  <p>in the following code. actually I need to use a Persian date time picker and I need to convert my number to English  so I forced to convert value as a string to replace characters.</p>
  
  <pre><code> public class DateTimeBinder : IModelBinder
  {
      private static readonly CultureInfo arabic = new CultureInfo("fa-IR");
      private static readonly CultureInfo latin = new CultureInfo("en-US");
      public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
      {
  
         var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
          String strvalue = (String)value.ConvertTo(typeof(String), CultureInfo.CurrentCulture);
  
          var latinDigits = latin.NumberFormat.NativeDigits;
          var arabicDigits = arabic.NumberFormat.NativeDigits;
  
          for (int i = 0; i &lt; latinDigits.Length; i++)
          {
              strvalue = strvalue.Replace(arabicDigits[i], latinDigits[i]);
          }
  
          var date = (DateTime)value.ConvertTo(typeof(DateTime), CultureInfo.CurrentCulture);    
          date = PersianCulture.PersianToGregorianUS(date);
          return date;
      }
  }
  </code></pre>