4

I have a db with time stamp values in this format: 0000-00-00 00:00:00 When I add this to the db I add a minutes to the current time. Now I need to check if the current time has passed the value added to the db. (x minutes passed)..

example add to db:

$time = strtotime ("+2 minutes");
$mysql_time = gmdate("Y-m-d H:i:s", $time);

Then I get that value from the db. And need to compare current time with that value. I used to use unix values like this: if(time() <= $unix_time){...} but now, I want to compare timestamp values instead.. Something like if(timeMysql() <= $mysql_time){..}

ganjan
  • 7,356
  • 24
  • 82
  • 133

1 Answers1

0

There's a function UNIX_TIMESTAMP that'll convert 0000-00-00 00:00:00 formatted value to linux timestamp integer.

You can use this: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_unix-timestamp

Slawek
  • 762
  • 4
  • 7