Re: how to display new icon for news posted within 2 days?

From: Date: Thu, 15 Jan 2009 13:50:57 +0000
Subject: Re: how to display new icon for news posted within 2 days?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-286425@lists.php.net to get a copy of this message
That should work as well Bastien Sent from my iPod On Jan 15, 2009, at 4:14 AM, paragasu <paragasu@gmail.com> wrote:
is it possible to do it like SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl $post = mysqli_fetch_object($sql); if($post->is_new) echo '<img src=new.gif">'; On 1/14/09, Phpster <phpster@gmail.com> wrote:
Make it easy and store the date as a unix timestamp. Then it's a
simple test    to do
If ((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


« previous php.general (#286425) next »