I have an input file which has to loaded daily to my table. I receive files in the following format sample sample_20120518_160754.CSV. Time stamps may vary, it is not current time stamp
I have used expression to get the filename along with date, but how can i get timestamp of the file.
This was the expression i have used to get the filealong with date.
"sample_" + RIGHT("0" + (DT_STR,4,1252)DATEPART("yyyy", (DT_DATE)@[User::p_varAsOfDate]), 4) + RIGHT("0" + (DT_STR, 2, 1252)DATEPART("dd", (DT_DATE)@[User::p_varAsOfDate]), 2) + (DT_STR, 2, 1252)DATEPART("mm", (DT_DATE)@[User::p_varAsOfDate]) +"_" +".CSV"
this expression yeilds result
sample_2012145_.CSV now i want time stamp of the file also.
Here's the expression that will give you the datepart + the time part as well. You can put additional delimiters in between to accomplish the format that you want.
(DT_STR, 4, 1252)DATEPART("yyyy", @[System::ContainerStartTime]) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("dd", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("hh", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mi", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("ss", @[System::ContainerStartTime]), 2) +
you can edit the above expression and use another variable of your choice. I chose the ContainerStartTime because of the ease.
@[User::miFilePath]+"AnyName"+"_"+(DT_WSTR, 04) YEAR( GETDATE() )+(MONTH(GETDATE())>=10 ? (DT_WSTR, 02)MONTH(GETDATE()): "0"+(DT_WSTR, 02)MONTH(GETDATE()))+ (DAY(GETDATE())>=10? (DT_WSTR, 02)DAY(GETDATE()): "0"+(DT_WSTR, 02)DAY(GETDATE()))+"_"+RIGHT("0" + (DT_STR, 2, 1252)DATEPART("hh", GETDATE()), 2) +RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mi", GETDATE()), 2) +RIGHT("0" + (DT_STR, 2, 1252)DATEPART("ss", GETDATE()), 2) + ".txt"