-
problems with my dates
i have a simple message board that shows the date an entry was posted. i have the list of entries sorted by date, however there is a problem. the sorting is not taking the year into consideration. for example, if a post with a date of 12/20/06 is considered newer than a post with a date of 4/20/07.
i am using a database for this message board. here's the code of a script that fetches the data and makes a table row out of it....
$strTemp2=$line['Issue'];
$strTemp1=$line['ID'];
$strTemp3=$line['Date'];
$hotDate = date("m/d/y", strtotime($strTemp3));
$oldHot = date("m/d/y", strtotime("7 days ago"));
if($hotDate <= $oldHot) {
$hotStyle = "class=\"oldHot\"";
} else {
$hotStyle = "class=\"newHot\"";
}
$strTemp.= "<TR ".$pstrDataRowParameters.">";
$strTemp.="<TD ".$pstrDataColumnParameters."><span><A HREF =\"javascript
opper('IssueDetails.php?ID=" .$strTemp1. "','POPPER','width=900,height=700')\" ".$hotStyle.">• ".$strTemp2. "[/url]</span></TD>";
$strTemp.="<TD ".$pstrDataColumnParameters.">" .$strTemp3. "</TD>";
as you can see, i've added different css styles to posts that are newer (by seven days). this css style simply displays the post in red if it's new. this is working fine, but it too is marking posts without considering the year. for example today is 8/17/07 so it marks a posts dated 8/24/06 and 12/12/06 in red.... i'm thinking again because it isn't paying attention to the year which would mean that date hasn't happend yet.
here's some code that displays the data (this is in the code of my site's index page).....
$strsql = "SELECT id as 'ID', title as 'Issue', DATE_FORMAT(date,'%m/%d/%y') as 'Date' ";
$strsql .=" FROM hotTopics_US_topics ";
$strsql .=" WHERE active='Y' ";
$strsql .=" ORDER BY date DESC";
$strsql .=" LIMIT $start,$numentries";
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks