KeeganWolf Posted June 15, 2009 Share Posted June 15, 2009 Hi, I just can't seem to figure this out. I have a system that parses information from a zip file according to the store number and date on a daily basis. It's always in the format of e.g. store 5081... S508106142009-06152009.zip Suddenly I have files coming in with 2 days between like. S508106132009-06152009.zip Which my code can't currently handle. This code tends to come out with a weird number for $daybefore $today = date("md20y"); // echo "Today is ",$today, "<br />"; $tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y")); // echo "Tomorrow is ".date("md20y", $tomorrow),"<br />"; $yesterday = mktime(0, 0, 0, date("m"), date("d")-1, date("y")); $daybefore = mktime(0, 0, 0, date("m"), date("d")-2, date("y")); // echo "Day before ----> ", $daybefore, "<br />"; // echo "Yesterday was ".date("md20y", $yesterday),"<br />"; // echo "Your store number is ",$store, "<br />"; // echo "Your store's filename will be S", $store,"".date("md20y", $yesterday), "-", $today, ".zip<br />"; $prevfile = 'S'.$store.date('md20y', $daybefore).'-'.$yesterday.'.zip'; $filename = 'S'.$store.date('md20y', $yesterday).'-'.$today.'.zip'; // echo "Previous filename is", $prevfile; I'm sure theres a better way of doing this, like only getting the newest filename as a value. Any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.