sh6210
sh6210

Reputation: 4540

In laravel now datetime showing wrong

Inside a laravel project,php's date('Y-m-d H:i:s') function is printing 6 hours minus time() and Carbon::now() is also printing the same.

Can anyone tell me, how can i print my current time?

In my laravel project's config/app.php I have set 'timezone' => 'UTC'.

Upvotes: 2

Views: 1264

Answers (2)

Tim
Tim

Reputation: 2187

You need to specify "your" timezone:

In config/app.php write:

'timezone' => 'Asia/Dhaka'

Upvotes: 4

Alexey Mezenin
Alexey Mezenin

Reputation: 163838

You can try to add timezone. Example from Carbon docs:

Carbon::now('Europe/London');

Upvotes: 4

Related Questions