title: C# CustomFormat DateTimePicker in RTL Language
body: <p>I got <code>DateTimePicker</code> control.
  I used the following code to set the format of the control:</p>
  
  <pre><code>dateTimePicker1.Format = DateTimePickerFormat.Custom;
  dateTimePicker1.CustomFormat = "HH:mm";
  </code></pre>
  
  <p>it worked with one problem. My computer culture language is RTL language (hebrew), so I see the format of the time in the control like that "mm:HH" althought I wrote "HH:mm". It caused by the RTL culture, So I tried two ways to solve it but none of them worked / worked completely.</p>
  
  <p>I tried:</p>
  
  <pre><code>System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US");
  System.Threading.Thread.CurrentThread.CurrentCulture = culture;
  System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
  </code></pre>
  
  <p>and it didnt work at all.</p>
  
  <p>I also tried to detect wheter its RTL language or not by using this code:</p>
  
  <pre><code>CultureInfo.TextInfo.IsRightToLeft
  </code></pre>
  
  <p>and then to reverse the format string from "HH:mm" to "mm:HH" (if its rtl language) but then I discovered another problem - in XP if its RTL language it will write the right format.. so yeah I can detect if its XP or not but I think this is too much code for simple need...</p>
  
  <p>Is there easier solution?</p>
  
  <p>Thanks!.</p>