the_corona said:
peoples said:
*snip*

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).

That's not necessary. If you want to be culture independent, just use the invariant culture:

 

string filename = string.Format(CultureInfo.InvariantCulture, @"D:\logs\{0:ddMMyyyy}.log", myDate)

 

This would have the same general effect as your code, without having to do manual date formatting.