-4

I do a lots of queries like:

SELECT THIS
FROM THAT
WHERE ROW_TIME < NOW()

How to create variable in PHP that will contain current time so i can make this work:

SELECT THIS
FROM THAT
WHERE ROW_TIME < '$variable'

?

Tom Smykowski
  • 25,487
  • 54
  • 159
  • 236

3 Answers3

6

the PHP date($format) function returns current time as a string. You can set the format using a string.

date("Y-m-d H:i:s")
Tim S.
  • 13,597
  • 7
  • 46
  • 72
1

The PHP date function will help.

SeanWM
  • 16,789
  • 7
  • 51
  • 83
0

You should use time() - it returns a timestamp. http://php.net/manual/en/function.time.php

Kyle
  • 1,757
  • 1
  • 12
  • 22