Date Add

Created by Jason Carr, Modified on Thu, 14 Mar at 6:17 PM by Jason Carr

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.

dRepresents the day of the month as a number from 1 through 31.  ddRepresents the day of the month as a number from 01 through 31.  
dddRepresents the abbreviated name of the day (Mon, Tues, Wed etc). ddddRepresents the full name of the day (Monday, Tuesday etc). 
h12-hour clock hour (e.g. 4). hh12-hour clock, with a leading 0 (e.g. 06) 
H24-hour clock hour (e.g. 15) HH24-hour clock hour, with a leading 0 (e.g. 22) 
mMinutes mmMinutes with a leading zero 
MMonth number (eg.3) MMMonth number with leading zero (eg. 04) 
MMM Abbreviated Month Name (e.g. Dec) MMMMFull month name (e.g. December) 
sSeconds ssSeconds with leading zero 
tAbbreviated AM / PM (e.g. A or P) ttAM / PM (e.g. AM or PM 
yYearMonthPattern yyYear (two digits) 
yyyyYear, (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

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article