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

Community forum

Frank2808
2013-05-15T19:53:19Z
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?
Support
2013-05-16T06:41:37Z
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
2013-05-24T06:09:20Z
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