A customer asked me recently about how to build a FoxPro expression that would give them a string like 21/08 for the week ending based on a 7 day week.
Using DOW , this is fairly easy;
? PADL(MONTH(DATE()-DOW(DATE())+1),2,’0′) + “/”+PADL(DAY(DATE()-DOW(DATE())+1),2,’0′)
Why do the +1? Because DOW() gives you the day of the week and by subtracting the DOW ( ) would take you to the end of the previous week.
Now, if you’re sorting by this, you’ll see I use the PADL so that it always put a zero in front of any single digit months (01 for January, etc).