Date & Time to C#

Hi,

In C#, as backslash is special character, it’s necessary to escape backslash or use @ as the following

"C:\\Users\Documents\\DL_"

OR

@"C:\Users\Documents\DL_" 

In addition, / and : cannot be used as file name (or file path if you want to use it as part of directory name ). So as a result,the following will work, for example.

@"C:\Users\Documents\DL_" +DateTime.Now.ToString("MMddyyyy-hhmm tt")

Regards,

1 Like