Moron Posted August 28, 2006 Share Posted August 28, 2006 [quote]$combodate = "$RESULT[LYR]$RESULT[Lmo]$RESULT[Lda]";[b]//combine year, month, date into a string.[/b]$combodatecode = strtotime($combodate);[b]//convert to UNIX timestamp.[/b]$lastjuly1 = date($last,0701);[b]//"$last" is the last year in which July 1 existed. I didn't include it here.[/b]$lastjulycode = strtotime($lastjuly1);[b]//convert to timestamp.[/b]echo "<td>";echo $RESULT['Lmo']; echo "/";echo $RESULT['Lda'];echo "/";echo $RESULT['LYR']; echo "</td>";[/quote]Okey-dokey. All of the above functions work because I can echo them and get a date or a timestamp, respectively. Here's the kicker.... if I echo $combodate, it seems to pull the date of a random record. If I leave it out, the above Lmo, Lda, and LYR lines pull records perfectly. It almost seems like I need to restrict records that don't exist yet until after $RESULT is called. I tried...[code]if ($combodatecode >= $lastjulycode) {echo "<td>";echo $RESULT['Lmo']; echo "/";echo $RESULT['Lda'];echo "/";echo $RESULT['LYR']; echo "</td>";}[/code]No go. It pulled two records when it normally (and should) pull eight.I also tried this inside the while loop. No go.Ideas? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 28, 2006 Share Posted August 28, 2006 [code]$combodate = mktime(null, null, null, $RESULT['Lmo'], $RESULT['Lda'], $RESULT['LYR']);$lastjuly1 = mktime(null, null, null, 7, 1, $RESULT['LYR'] - 1);echo '$combodate = ' . $combodate . ' which is: ' . date("Y-m-d", $combodate) . "<br />";echo '$lastjuly1 = ' . $lastjuly1 . ' which is: ' . date("Y-m-d", $lastjuly1);[/code] Quote Link to comment Share on other sites More sharing options...
Moron Posted August 28, 2006 Author Share Posted August 28, 2006 [quote author=hitman6003 link=topic=105970.msg423534#msg423534 date=1156795125][code]$combodate = mktime(null, null, null, $RESULT['Lmo'], $RESULT['Lda'], $RESULT['LYR']);$lastjuly1 = mktime(null, null, null, 7, 1, $RESULT['LYR'] - 1);echo '$combodate = ' . $combodate . ' which is: ' . date("Y-m-d", $combodate) . "<br />";echo '$lastjuly1 = ' . $lastjuly1 . ' which is: ' . date("Y-m-d", $lastjuly1);[/code][/quote]Thanks. This code works, but how do I incorporate it into the while satement? In other words, I only want to display records from the previous July 1 of the fiscal year ($last). Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted August 28, 2006 Share Posted August 28, 2006 what format are you storing the date in your database? Quote Link to comment Share on other sites More sharing options...
Moron Posted August 29, 2006 Author Share Posted August 29, 2006 [quote author=hitman6003 link=topic=105970.msg423554#msg423554 date=1156797547]what format are you storing the date in your database?[/quote]It's Month (2-digit), Day (2-digit), and Year (4-digit).Thanks! 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.