ToString() -- 'No overload for method ToString takes 1 argument' error

Hi:

I'm trying to display a dateTime value in the format '07/31/06' but when I use the ToString() as follows I get the above errormessage, despite the fact that the documentation clearly shows that ToString( string ) exists. What's up with this

string timeStr = myDate.ToString("mm dd yy");

I also tried string timeStr = myDate.ToString( "d");

with the same result...

Thanks for all help!

John F.



Answer this question

ToString() -- 'No overload for method ToString takes 1 argument' error

  • TRENTT

    try this,

    string timeStr = myDate.ToShortDateString()



  • wspencers

    The myData isn't a DataTime type i geus because the DataTime struct contains a ToString method overload that excepts a string.


  • JCMeyer

    What kind of type is myDate


  • ToString() -- 'No overload for method ToString takes 1 argument' error