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


we run many jobs weekly and need to name output files in naming convention like Name_<year>_<cw>.csv, where cv is calendar week and year is a year of that week. Mostly we run scripts for previous (complete week). I would suggest to create new built in variable last week, that would return complete previous week. The best would be to have an option, how to format output (week number of last week - with leading zero, year of last week, start day (first day of last week), end day (last day of last week), first working day of last week, last working day of last week).

Example: On 14.2.2020 I use this function with output formatting year_cw and I'll get 2020_06.
Example 2: On 2. 1. 2020 I use this function with output formatting year_cw and I'll get 2019_52.

With current variables this could not be done effectively (scripting required, as seen here: https://www.visualcron.c....aspx?g=posts&t=2199 ). The only option is to get current week number, but this makes troubles when years change.

Thank you.
Forum information
Dobry den! This 2-line powershell script can return the info you want. Note that the %V format character for week of the year is supposed to return a leading zero, but VC seems to suppress it.

#$save_date = (get-date "1/2/2020" ).AddDays(-7) # For testing
$save_date = (get-date).AddDays(-7)
get-date $save_date -uformat "%Y_%V"
Hi Gary_W,

thanks for posting this tip, I appreciate your help. I'm aware that many missing functions can be bypassed by Powershell and other means, however I thought it would be more convenient to have built-in function rather than coding it (I could write whole job into PowerShell script and wouldn't need VC at all 🙂. We try to keep our jobs as simple as possible, with your approach there is one more step needed.
Scroll to Top