Formatting Problem Date with DateTime
- by Florian
Hello,
I want to display a date with this format :
MM/dd/yyyy HH:mm:ss tt
for example :
01/04/2011 03:34:03 PM
but I have a problem with the following code
class Program
{
static void Main(string[] args)
{
DateTime dt = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
string displayedDate = dt.ToString("MM/dd/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);
Console.WriteLine(displayedDate);
Console.Read();
}
}
displays :
01/04/2011 12:00:00 AM
instead of
01/04/2011 00:00:00 AM
Anyone knows why ?
Thank you !