<p>Not sure what's going on here.</p>

<p>I have a DateTime object, and when I try:</p>

<pre><code>String.Format( "{0:dd/MM/yyyy}", _date)
</code></pre>

<p>the value returned is:</p>

<pre><code>"24-05-1967"
</code></pre>

<p>What I want is</p>

<pre><code>"24/05/1967"
</code></pre>

<p>Can anyone explain why my format string is being ignored? </p>

<p>A bit more background:
This is a web app which started out life as .net 1.1, and I'm in the process of moving it up to 2.0/3.5.  </p>

<p>Update:</p>

<p>If I change the format to {0:dd:MM:yyyy}, it returns 24:05:1967 - it's only the / in the format string that gets changed to the - char.</p>

<hr>

<p>Resolution:</p>

<p>When updating the app to run under 2.0, the asp.net globalization settings were messed up.  </p>

<p>From the web site properties, ASP.NET tab, Edit Configuration, Application Tab - the culture and UI Culture were both set to the first item in the list (af-ZA) for some bizarre reason. </p>

You likely want to use the
ToString()
method of your DateTime object to get the string representation you are after. A format string of
"dd'/'MM'/'yyyy"
will give you the format you described. Note that you need to escape literal characters in the format string using single quotes.
Example:
```
DateTime.Now.ToString("dd'/'MM'/'yyyy");
```