Hi All,
How can I get a timeStamp of a CSV file and store it in the column of a datatable?
I would like to do following things:
- Read all records in CSV file and store it in a datatable.[Done using Read CSV activity]
- Add column called File TimeStamp. [Done using Add Column activity]
- Get file timeStamp and store it in a column created in 2nd step. [Help required]
Thank you!
Shyamal Dave.
vvaidya
(Vinay Vaidya)
2
File.GetLastWriteTime(csv path).ToString
will give the timestamp.
Why not pass the above value to DefaultValue in Add Data Column activity in #2 step.
Ok. This works. Thanks vvaidya.
what if I just want the date not the time ?
Dave
(David Wiebelhaus)
5
Same thing as before but the .ToString you specify the format. So it’s File.GetLastWriteTime(csv path).ToString("MM/dd/yyyy")
You can choose whatever format you’d like for the datetime - see all combinations here: Custom date and time format strings | Microsoft Learn