Re: how to display new icon for news posted within 2 days?
| From: | Phpster | Date: | Thu, 15 Jan 2009 04:30:31 +0000 |
| Subject: | Re: how to display new icon for news posted within 2 days? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286405@lists.php.net to get a copy of this message | ||
Make it easy and store the date as a unix timestamp. Then it's a
simple test to doIf ((current timestamp - db timestamp) < 172,800 ){ echo '<img src='new.gif'>'; } Conversely, you can use strtotime() to convert the date. Bastien Sent from my iPod On Jan 14, 2009, at 10:36 PM, paragasu <paragasu@gmail.com> wrote:
i do have a mysql table with one date field. what i want is to display and tiny icon (red new icon) so user will notice it is a new post. i am looking for the simplest solutions here. i believe we can calculate whether the date is within two days of user current time. then we display an icon based on it. can anyone help? thanks --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php