User date input
Hi there, I`m wondering how to prompt the user for date input and how to store the data? I`m going to write some code witch main role is going to be comparing the inputed date with actual date. Do you think simple DateTime.Parse... will do the job? Appreciated for any tips and tricks.
12/16/2019 10:47:29 PMVendetta
3 AnswersNew Answer
It really depends how monkey proof your application need to be. Is it enough to just return "Wrong date input" or do you want to give more information to the user like "Invalid month value" DateTime.Parse can be enough also be aware of DateTime.TryParse https://www.dotnetperls.com/datetime-tryparse I think you should print the expected datetimeformat like "yyyy-mm-dd" so the user does not have to guess. Or you can ask 3 questions first yearinput second monthinput third dayinput This can be helpfull or really boring. There is not a right way to do it, you should know what your users are expecting.
Thanks for the answer, it was very helpful. For now it's only a practice task but if it will work the way i want it to maybe some of my co-workers could use it to make somethings a bit easier and faster.
Hello, you izuchaej C#