convert to DateTime


T

Thomas Lindroos

how to convert this???


string strDate = "19701105";
DateTime myDate = System.Convert.ToDateTime(strDate);

ideas anyone

/thomas lindroos
 
Ad

Advertisements

J

Jon Skeet [C# MVP]

Thomas Lindroos said:
how to convert this???
string strDate = "19701105";
DateTime myDate = System.Convert.ToDateTime(strDate);
Hvae a look at DateTime.Parse and DateTime.ParseExact, where you can
specify your own format.
 
Ad

Advertisements

J

James Black

Thomas said:
string strDate = "19701105";
DateTime myDate = System.Convert.ToDateTime(strDate);
If you know the format is set, then just take a substring of the
first 4 characters, turn it into an int, and set DateTime by using the
year, month and day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DateTime convert 7
Converting DateTime 0
datetime convertion 3
Datetime convert 2
converting datetime 4
Convert string to datetime 5
Convert DateTime to string? 3
how to convert datetime 2

Top