Mohan S

Mohan S

  • NA
  • 34
  • 38.8k

DateTime not displaying properly - Parking fee Console app

Nov 9 2015 3:32 AM
Hi Guys,
 
Though i can find many examples related to Parking fee code, i dint find a code the way am trying below.
 
Am posting initial code here:
 
Though i give the correct input, i dint get the expected output here. 
Input: 2015/11/09 01:30:15
Output: 01/01/0001  01:15:30 AM
 
The Date and Time is wrong, and how to handle AM and PM ? 
 
Console.WriteLine("Please enter list of cities");
String input1 = Console.ReadLine();
DateTime dt1;
bool res1 = DateTime.TryParseExact(input1, "yyyy/MM/dd hh:mm:ss", null, System.Globalization.DateTimeStyles.None, out dt1);
Console.WriteLine(dt1);
Console.ReadLine();
 
 
 
 

Answers (6)