N
N
nikkon822020-09-16 08:27:39
Laravel
nikkon82, 2020-09-16 08:27:39

How to correct the output from the date and time database on vue + laravel?

Good day!

Can someone tell me what the problem is?

Site on Laravel (backend) + Vue (frontend).
The current date is written to the database through Laravel - Carbon::now()
In the Lara timezone settings Europe/Moscow is set
The date is written correctly to the database - for example 2020-09-16 08:20:32

But on the site from the database, the time is 3 hours less, those. 05:20

In xampp added
1) In httpd.conf (\xampp\apache\conf\httpd.conf):
SetEnv TZ Europe/Moscow

2) php.ini (\xampp\php\php.ini) :
date.timezone = "Europe/Moscow"

3) In my.ini (\xampp\mysql\bin\my.ini)
default-time-zone = "Europe/Moscow"

restarted servers

But the time still shows minus 3 hours on the site.
Moreover, when I used pure Laravel (without vue) in another project, it was enough to change the time zone in Lara's config and everything was correct on the site without manipulating xampp.

Maybe vue needs something?
Tell me pliz

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Wells, 2020-09-17
@Alex_Wells

Everywhere you write UTC. On the server, for PHP, for the stall. In VueJS, you take and convert the date to the desired one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question