2

I can not call the now() function inside a class.

Call to undefined function now()

How can I use the now() function?

class timeClass extends someClass
{
    public function update_login_time()
    {
        $time = now();
        return $time;
    }
}
Leon Adler
  • 2,993
  • 1
  • 29
  • 42
Rocket Chimp
  • 41
  • 2
  • 5
  • 4
    `now()` is a mysql function. https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_now See: http://stackoverflow.com/questions/1995562/now-function-in-php – chris85 Jan 23 '16 at 02:18
  • try date function. go to [link](http://php.net/manual/en/function.date.php) – Baron Jan 23 '16 at 03:43

1 Answers1

6

There's no now() function in PHP

You can use date("Y-m-d H:i:s") instead

Elie Faës
  • 3,215
  • 1
  • 25
  • 41