FormatException: String can't convert to DateTime ?
Hello,
I'm working on a "pet manager" game, and I want to compare the date before the user quit, with the date when he come back, to reduce some caracteristics. I made a function getTimeSpan(), in which I return :
DateTime.Now - Convert.ToDateTime(PlayerPrefs.GetString("then));
I have a function which set the string for "then" (I made PlayerPrefs.SetString("then", getStringTime());
My function getStringTime() return
DateTime.Now.month + "/" + DateTime.Now.Day + "/" + DateTime.Now.Year+ " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
My problem now is that it doesn't work, it was wrote in my console log "FormatException: String was not recognized as a valid DateTime." I don't understand what the problem here, someone could help me please ? :) (ps : sorry for my bad english)
Your answer
Follow this Question
Related Questions
Tycoon like game time and date 1 Answer
TimeZone Not Found Exception 3 Answers
DateTime.Today for Different Time Zone 1 Answer
Looking For A Better Way To Check If Day Has Passed 1 Answer
Formatting a timespan into a relative date in JavaScript 0 Answers