Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
manage timezones JS difference of two hours

frontend side I send axios this date away:

Mon Jun 13 2022 18:29:00 GMT+0200 (Ora legale dell’Europa centrale)

because the backend (laravel 8.x) side saves me the usual one as follows:

2022-06-13 16:29:00

I wish he would save me 18:29 and not 16:29

how can i handle this? i can't install libraries like moment.js

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

This will likely be due to your app timezone being set to UTC. I personally would recommend storing everything in UTC and converting that for display purposes on the front end.

However, if you must store them in the same format, you'll need to set the timezone in config/app.php

/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/

'timezone' => 'UTC', <--- Change this to your timezone eg: Africa/Cairo

Select the correct timezone from this list.

Timezones available for GMT+0200

Don't forget to run php artisan config:clear to ensure your timezone configuration changes are being used.

about 4 years ago · Juan Pablo Isaza Relatório

0

I solved as follows:

    return new Date(year, month - 1, day, hours, minutes, seconds).toString().slice(0, 24);

can you do better?

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda