XmlAdoNewbie <(E-Mail Removed)> wrote:
> I am trying to bind a date in the form of "20031218" to a datetime
> object. I first try to convert the string using
> Convert.ToDateTime("20031218") but i get an invalid date time
> exception. I think I should be using the IFormatProvider in one of the
> overloaded methods of Convert.ToDateTime but i can't find any
> documentation that is easy to understand.. i am a newbie if you will.
> Any code examples of how to do this would be great.. this is what i
> have so far.
I suggest you use
DateTime.ParseExact (value, "yyyyMMdd", CultureInfo.InvariantCulture);
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too