dear all,
I read the date time in an file’s name, like 20200408, then write this date to an excel file’s cell,
how could I change the date format 20200408 into 2020-04-08 in this excel cell?
anybody could help me ? thanks a lot in advance.
dear all,
I read the date time in an file’s name, like 20200408, then write this date to an excel file’s cell,
how could I change the date format 20200408 into 2020-04-08 in this excel cell?
anybody could help me ? thanks a lot in advance.
You can convert data before writing to excel
DateTime.ParseExact(“20200408”,“yyyyMMdd”,nothing).ToString(“yyyy-MM-dd”)
You can always use the Insert method since your file name is a string value.
For instance, if your file name was 20200408.xlsx you can use the Assign activity twice to change the value of a variable.
First create a string variable (fileName) with the name of your file. Then, add two Assign activities.
fileName = fileName.Insert(4,“-”)
fileName = fileName.Insert(7,“-”)
Hope this helps!
not the name, just the cell in excel
if the 20200408 is a variable, how could i use this function? like this?
DateTime.ParseExact(“variable”,“yyyyMMdd”,nothing).ToString(“yyyy-MM-dd”)
Use variable without double quotes
DateTime.ParseExact(variable,“yyyyMMdd”,nothing).ToString(“yyyy-MM-dd”)