Tech Off Post

Single Post Permalink

View Thread: C# Sting converstion
  • User profile image
    the_corona

    peoples said:
    peoples said:
    *snip*

    Just one more question, I think if you call the datetime value you get a format like 11/12/2009, is it just a case of parseing out the "/" to make up the file name I want to use it as ?

     

    Thanks

    Its better to do something like

     

    string filename = string.format("d:\\logs\\{0}{1}{2}.log", myDate.Day, myDate.Month, myDate.Year);

     

    Date.ToString() looks different depending on the local of the user, so parsing out / wont work for instance for german versions of windows (+ its really ugly).