OK ... the first lines of your code are choosing the first day to download, 3/31/08 in this case:
# get all important files from MLB.com, 3/31/08 through yesterday #$start = timelocal(0,0,0,31,2,108); $start = timelocal(0,0,0,31,2,108);
Read up on the timelocal function if you need more explanation of this part. In fact, read up on timelocal before continuing, or the next bit won't make sense.
You want to start downloading "yesterdays" file, instead of that hardcoded date. So you need to figure out how to get yesterday's date in the same format that timelocal is going to give it to you (so you don't need to change the code).
It turns out that timelocal returns the number of seconds since XXXXX. The time function returns the *current* date/time also in seconds since XXXXX. So time almost gives you what you want. Since there are 24 * 60 * 60 seconds in a day, if you subtract that from time, you'll get the same time yesterday. So you could change the lines above to:
# Start downloading from yesterday $start = time - 24*60*60;
The rest of the code (including $now) should be just fine. I hope this helps!
...roboticusNote: The XXXXX is a specific date, but it's unimportant, so I didn't bother to specify.
Update: Added bit about $now.
In reply to Re^3: Help with Time
by roboticus
in thread Help with Time
by TheAnswer1313
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |