How to get timeStamp of a file and store it in a datatable column?

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:

  1. Read all records in CSV file and store it in a datatable.[Done using Read CSV activity]
  2. Add column called File TimeStamp. [Done using Add Column activity]
  3. Get file timeStamp and store it in a column created in 2nd step. [Help required]

Thank you!
Shyamal Dave.

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 ?

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

Thank you for the link