Need Help about time difference

Started on the old forum in March 2013 · view the original in the archive · old links redirect here

6 replies · 675 views · started 13 years ago · 1 min read

4 participants
asifnayem Developer · 119 posts #1

Hi,

I can't explain this on the title. sorry for that. What I need is: On my mysql there are several news published in the morning. each comes one after another and sometimes at the same time. I want that it will differentiate with current times with the news time and will highlight the upcoming news. My mySQL table data's are given below:

while...
echo "<ul style='newsrow'>;
{
echo "<li>".$row['date']." - ".$row['time']." - ".$row['news']."</li>";
}
echo "</ul>";

Can any one help me on this?

Regards

asifnayem Developer · 119 posts #3

pichiriche wrote: Sql code ? Post here

$result = mysql_query("SELECT * FROM `newsline` WHERE date='$data' order by time asc");
while ($row = mysql_fetch_array($result)) {
echo "<ul style='newsrow'>";
{ 
      echo "<li>".$row['date']." - ".$row['time']." - ".$row['news']."</li>"; 
} 
echo "</ul>";  
asifnayem Developer · 119 posts #4

Can anyone help me out on this??

Mysterio Lead · 630 posts #5

This is a bit complicated as idea. Why not store the date in a timestamp format? Then you can select passed ones, or coming next ones, etc.

mysterio.al - programming is a functional art

asifnayem Developer · 119 posts #6

Well, if I can save the time as timestamp format but still, I don't have any idea how to highlight the next news?

Vayne Developer · 106 posts #7

WHERE date='$data' AND date>date(); ORDER BY time DESC LIMIT 1; ?

Nous Ne Dansos Pas, Nous Sommes Le Danse.!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close