Is there an easy way to convert a string to the DateTime type? I am retrieving the value from an SQL Database and I want to store it in a DateTime object. What is the easiest way to do this? Thanks in advance.
You can call the Parse method on the DateTime structure, or you can use the Convert class, which has a static method called "ToDateTime" that has many overloads, one of which takes a string. ToDateTime() ends up calling the DateTime.Parse method internally, so use whichever is most convenient for you.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.