Variable - Last Tuesday based on current date - VisualCron - Forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Frank2808
12 years ago
Hi, I'm using the FTP task to download a file. Each file has the date it was created in the file name formatted as yyyyMMdd. What I would like is the variable for the pervious Tuesday from the current date.

Pseudo mask, which doesn't work :)

Testfile_{DATE(LastTuesday|yyyyMMdd)}.zip

Any ideas?
Sponsor
Forum information
Support
12 years ago
I would like to give you some points for a nice try :)

Anyway, what you can do, if you know which day you are running this (perhaps the week after) you can use this:

Testfile_{DATENOWADD(Days|-7|yyyyMMdd)}.zip
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
12 years ago
Hi,

You can also use the .NET task to calculate this for you.

This could be a function you can use:

public static string GetLastThursday()
 {
        DateTime date = new DateTime();
        date = DateTime.Now;
        while (date.DayOfWeek != DayOfWeek.Thursday)
            date = date.AddDays(-1);

        return = date.ToString("yyyyMMdd");
 }


After this task you can use the output as the variable for your zip name.

Regards,
Erik
Uses Visualcron since 2006.
Scroll to Top