Date Replacement allows us to dynamically change the date. For example, each week we wish to download a syndicated show from an FTP Server. The problem comes when the syndicator changes the date each week within the filename. Without Date Replacement, you would have to change the file that FileCopy looks for each week. Date Replacement solves this problem.
Setting Up The Filename
1. First copy the filename you wish to download and work out what the date format is. Example: American Top 40 Part 1 01-03-2020.mp3.
2. From this example, we are going to place a pair of curly brackets around the date part of the filename. This would look like American Top 40 Part 1 {01-03-2020}.mp3
3. Next, we must work out what the date format is. We can do this by looking it up using the Standard Microsoft Date Format or using the table below.
d | Represents the day of the month as a number from 1 through 31. | dd | Represents the day of the month as a number from 01 through 31. |
ddd | Represents the abbreviated name of the day (Mon, Tues, Wed etc). | dddd | Represents the full name of the day (Monday, Tuesday etc). |
h | 12-hour clock hour (e.g. 4). | hh | 12-hour clock, with a leading 0 (e.g. 06) |
H | 24-hour clock hour (e.g. 15) | HH | 24-hour clock hour, with a leading 0 (e.g. 22) |
m | Minutes | mm | Minutes with a leading zero |
M | Month number (eg.3) | MM | Month number with leading zero (eg. 04) |
MMM | Abbreviated Month Name (e.g. Dec) | MMMM | Full month name (e.g. December) |
s | Seconds | ss | Seconds with leading zero |
t | Abbreviated AM / PM (e.g. A or P) | tt | AM / PM (e.g. AM or PM |
y | YearMonthPattern | yy | Year (two digits) |
yyyy | Year, (e.g. 2015) | &l / &U | Specifies that the return string should be in Lower or Upper case |
%%Week_No%% | Returns the calendar week number | %%Week_No_2%% | Returns the calendar week number padded with zeros. |
%%Broadcast_Week_No%% | Returns the broadcast week number. The broadcast week is the Calendar Week - 1 | %%Broadcast_Week_No_2%% | Returns the broadcast week number padded with zeros. The broadcast week is the Calendar Week - 1 |
4. In our example our filename would be American Top 40 Part 1 {MM-dd-yyyy}.mp3 (American Top 40 Part1 Month-Day-Year.mp3)
Calculating How Many Days To Add
Now that we have our filename we still need to tell FileCopy which date to use. To do this we need three pieces of information.
1. The Filename Date. With American Top 40, the syndicator always uses the date of the up and coming Saturday.
2. The Base Date. The base date is the day we want to download this file. For this example, we will download the file each week on a Wednesday.
3. Date Add. The date add tells FileCopy to add X number of Days to the base date. For our example, we will download the file on a Wednesday but the date we want is Saturday's. Therefore we will Date Add 3 to give us Saturdays Date.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article