Moron Posted August 14, 2006 Share Posted August 14, 2006 Let me try this again. Our fiscal year begins on July 1, so how do I get the last occurrence of July 1? Example: 07012006. I also want it to know and post the correct year. Quote Link to comment Share on other sites More sharing options...
Caesar Posted August 14, 2006 Share Posted August 14, 2006 Kinda vague.Where do you want to get this last occurance? From a database? What type of database? MySQL? Can you post the current code you have? What format are these dates stored as? Quote Link to comment Share on other sites More sharing options...
Moron Posted August 14, 2006 Author Share Posted August 14, 2006 [quote author=Caesar link=topic=104236.msg415676#msg415676 date=1155579414]Kinda vague.Where do you want to get this last occurance? From a database? What type of database? MySQL? Can you post the current code you have? What format are these dates stored as?[/quote]Sorry I wasn't more clear. No, I don't mean the last occurrence with data. I mean the last time that date happened. For example, the last time it happened was July 1, [b]2006[/b]. If I had ran this program back in May or whatnot, then it would show the last occurrence as July 1, [b]2005[/b], and so on. Quote Link to comment Share on other sites More sharing options...
Caesar Posted August 14, 2006 Share Posted August 14, 2006 You will need to store that information in order to make a reference to the last time the script was last accessed. If that is indeed your goal. Still unclear as to what it is you're asking. Regardless of what you're asking though, you will need to store data to make a reference to it, or compare it. Quote Link to comment Share on other sites More sharing options...
Moron Posted August 14, 2006 Author Share Posted August 14, 2006 [quote author=Caesar link=topic=104236.msg415687#msg415687 date=1155581146]You will need to store that information in order to make a reference to the last time the script was last accessed. If that is indeed your goal. Still unclear as to what it is you're asking. Regardless of what you're asking though, you will need to store data to make a reference to it, or compare it.[/quote]Okay, I guess I'm not expressing myself very well. Sorry, but this is also a bit confusing to me. It's actually very simple. What year was the last occurrence of July 1? That's it. As of right now, the answer would be July 1, 2006. This time next year, the code will show that the last occurrence was July 1, 2007, and so on. Our fiscal year begins July 1, but I need it to be Year-aware. Make sense? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted August 14, 2006 Share Posted August 14, 2006 Err...[code]<?php$curr_month = date('n');$curr_day = date('j');$curr_year = date('Y');if(($curr_month ==6 && $curr_day >= 1) || $curr_month >6){$last = $curr_year;}else{$last = $curr_year - 1;}echo 'July 1 '.$last;?>[/code]Untested, but should work Quote Link to comment Share on other sites More sharing options...
Moron Posted August 14, 2006 Author Share Posted August 14, 2006 Thanks, Ginger! That works! :) 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.