Ronald Ronald - 1 year ago 115
PHP Question

Laravel doesn't fetch date/time from server

I'm using laravel with xampp as it's server. But it doesn't seem to get the proper time. I tested this by having this code:

echo $today = date("Y-m-d H:i:s");
on a page in "htdocs" (not laravel just plain php) and on a function inside a laravel controller. The "today.php" in htdocs work while the one in laravel doesn't.

Any idea where I can configure the date/time in my laravel application?


Answer Source

To solve the problem, I set Default time zone in controller, but this is tedious though since I have multiple controllers.

$today = new DateTime();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download