c# - Convert a user's 24h input to 12h -
so reason comes error message saying 'no overload method'parseexact' takes 1 argument'. know i've done wrong?
static void runtimeconverter() { double arrivaltime; arrivaltime = getarrivaltime(); string time = datetime.parseexact(arrivaltime).tostring("hh:mm tt"); console.writeline("equals " + time); } static double getarrivaltime() { console.writeline ("enter time in 24 hour format convert 12hour"); string timeselected = console.readline(); int timeinput = int.parse(timeselected); return timeinput; }
so reason comes error message saying 'no overload method'parseexact' takes 1 argument'. know i've done wrong?
yes. can not read or refuse process error message compiler shows - exact in wrong.
your code:
datetime.parseexact(arrivaltime)
that 1 argument. compiler says wrong.
if check documentation:
http://msdn.microsoft.com/en-us/library/w2sa9yss(v=vs.110).aspx
it shows method as:
public static datetime parseexact( string s, string format, iformatprovider provider ) that 3 arguments. give one. not more obvious. fix code.
Comments
Post a Comment