title: how to fix string was not recognized as a valid DateTime
body: <p>See the end of this message for details on invoking
  just-in-time (JIT) debugging instead of this dialog box.</p>
  <pre><code>************** Exception Text **************
  System.FormatException: String was not recognized as a valid DateTime.
     at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
     at System.Convert.ToDateTime(String value)
     at ExtraTutoManager.Dashcont.CulcPay(DateTime dateAf) in D:\coure du soire gestion\visual studio project\ExtraTutoManager\ExtraTutoManage
  </code></pre>
  <p>declaration global</p>
  <pre><code>
          public DateTime rendVous;
          public DateTime temp;
  </code></pre>
  <p>I want to covert string to datetime by ToDateTime() , in my project VS running without any problem but in another pc this String was not recognized as a valid DateTime</p>
  <pre><code>temp = Convert.ToDateTime(&quot;&quot; + dateAf.Date.Day + &quot;/&quot; + (DateTime.Now.Month + 1) + &quot;/&quot; + DateTime.Now.Year);
  </code></pre>
  <p>this is my method</p>
  <pre><code>        //Culcs
          public DateTime Culcdate(DateTime dateAf)
          {
  
  
              int mont = DateTime.Now.Month - dateAf.Date.Month;
              if (DateTime.Now.Month == dateAf.Date.Month)
              {
  
                  temp = Convert.ToDateTime(&quot;&quot; + dateAf.Date.Day + &quot;/&quot; + (DateTime.Now.Month + 1) + &quot;/&quot; + DateTime.Now.Year);
              }
              else if (mont - (mont - 1) &gt;= 1 &amp;&amp; DateTime.Now.Day &gt;= dateAf.Date.Day)
              {
                  temp = Convert.ToDateTime(&quot;&quot; + dateAf.Date.Day + &quot;/&quot; + (DateTime.Now.Month + 1) + &quot;/&quot; + DateTime.Now.Year);
  
              }
              else if (mont - (mont - 1) &gt;= 1)
              {
                  temp = Convert.ToDateTime(&quot;&quot; + dateAf.Date.Day + &quot;/&quot; + DateTime.Now.Month + &quot;/&quot; + DateTime.Now.Year);
  
              }
  
              return rendVous = temp;
          }
  </code></pre>