PHP: Error "Call to undefined function now()"
Question by Guest | 2016-07-24 at 17:52
I want to retrieve the current date using PHP and I have written the following code for that:
$d = now(); echo date("d.m.Y", $d));
However, I get the following error when running this lines:
Fatal error: Uncaught Error: Call to undefined function now()
What am I doing wrong? How can I fix this error? And how can I determine and get the current timestamp in PHP as variable?
Related Topics
Lazarus: Program without GUI - Many WSRegister Errors
Question | 6 Answers
Delphi: Global Treatment of Errors (Exceptions)
Tutorial | 0 Comments
Create Custom Error Pages for Website
Tip | 0 Comments
PHP: Current Date and Time
Tutorial | 0 Comments
jQuery: Send HTML5 Canvas to Server via Ajax
Tutorial | 0 Comments
How to get rid of annoying telemarketing calls once and for all
Tip | 0 Comments
HTML Form: Redirection depending on Radiobutton or Checkbox State
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
The function now() is indeed available in some other programming languages, but not in PHP. There, for the same purpose, you can use the function time() instead:
This code should output the current date.
2016-07-25 at 15:11