I have a program that manages clients arrival, and whenever a new client is created, the TimeSpan
property TimeOfArrival
is assigned the current time of day with :
TimeSpan TimeOfArrival = DateTime.Now.TimeOfDay;
Now I'm trying to put that in a more convenient format that way :
string ShortTime = TimeOfArrival.ToString("hh:mm");
Though now I get the following exception :
System.FormatException: 'Input string was not in a correct format.'
I can't seem to understand what the problem is. I checked and TimeOfArrival actually has a correct TimeSpan value right before I get the exception. That exception wouldn't surprise me if I was trying to parse an user input into a TimeSpan, but there I'm confused. Could anyone help ? Thanks in advance