Tech Off Post

Single Post Permalink

View Thread: C# Sting converstion
  • User profile image

    W3bbo said:

    An "int" date?


    If you've got a DateTime instance, just call myDate.ToString(); you can optionally specify a format-string or predefined culture settings to get the right format (e.g. myDate.ToString("yyyy-MM-dd"); or myDate.ToString(CultureInfo.CurrentCulture); )


    In .NET, every class inherits Object's .ToString() method, by default this method simply returns some basic information gained from Reflection, but some types (such as DateTime) override the behaviour. There is also the System.Convert class, but I find myself rarely using it (since it's nothing you can't do with the existing .TryParse / .Parse / .ToString methods.

    Yeah I wonder if the OP meant:


    an International Date ?

    or possibly some long int format like 12252009 ?