DateTime ToString and Construction
-
Hi, I have saved a
DateTime
object to a configuration file using theDateTime.ToString()
method. I now want to read the setting and create a newDateTime
object from it. How is this possible? I need both the date and time. I think I could store the day, date, month, year, hours and minutes but this seems overkill and would mean me reading many settings from my configuration file. Surely there is a better solution? Thanks :) -
Hi, I have saved a
DateTime
object to a configuration file using theDateTime.ToString()
method. I now want to read the setting and create a newDateTime
object from it. How is this possible? I need both the date and time. I think I could store the day, date, month, year, hours and minutes but this seems overkill and would mean me reading many settings from my configuration file. Surely there is a better solution? Thanks :)Use the
DateTime.TryParse
orDateTime.Parse
method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Hi, I have saved a
DateTime
object to a configuration file using theDateTime.ToString()
method. I now want to read the setting and create a newDateTime
object from it. How is this possible? I need both the date and time. I think I could store the day, date, month, year, hours and minutes but this seems overkill and would mean me reading many settings from my configuration file. Surely there is a better solution? Thanks :)