Hi to all
i just cant get the grasp of what im trying to do basically i'm making a script that will higlight a certain data(Date /time) in my table if data < 3 min of current time..

ex

$data="March 12, 2013, 16:18";
$current_time="March 12, 2013, 16:20"

if($data< 3min of $current_time)
{
echo"highlight me im fresh";
}
else if($data > 5min of $current_time)
{
echo"oldies";
}

something like that but i cant find a way to implement

Recommended Answers

All 4 Replies

Hi,
You can use strtotime() to convert string date-time in timesamp, then compare.
Something like this:

$data = "March 12, 2013, 16:18";
$current_time = "March 12, 2013, 16:22";
if(strtotime($data) < (strtotime($current_time) - 180)) {
  echo"highlight me im fresh";
}
else {
  echo"oldies";
}

@MarPlo thanks men..it works for me just need to modify it to fit my needs...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.