0

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

Edited by ehpratah

4
Contributors
4
Replies
28
Views
4 Years
Discussion Span
Last Post by ehpratah
1

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";
}
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.