Replace / with - while savinf file from todays date

Hi All,

I am saving my file by date but my date is comming in (dd/MM/yyyy) formate but excel file name doesnot support this "/"operator.
How my file name is comming:- Feed_09/01/2020.xlsx
How i want :- Feed_09012020.xlsx

@Gauri_Rawool

Try to replace the \
eg string path = Feed_09/01/2020.xlsx then replace the path variable by
path = Path.replace(β€œ/”,β€œβ€)

1 Like

Hi
Usually file path won’t take these two symbols along the path /, \

So to save them if the input is in strinput
stroutput = strinput.ToString.Replace(β€œ/β€œ,””)

To be even more better
stroutput = strinput.ToString.Replace(β€œ/β€œ,”_”)

So the output would be like
Feed_09_01_2020.xlsx
Which will be easy to identify the date and month

Cheers @Gauri_Rawool

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.