1

I've realized my application is writing dates the day before they are indicated (For example, when inserting dates within a spreadsheet file import). I set the local timezone once and now all dates are 4 hours earlier and the day before. How can I fix these so that it doesn't happen again.

config/app.php says: 'timezone' => 'America/Santiago'

(When I type now() on tinker date and time are right).

Should I leave it as 'UTC'? Was that the cause?

What do I do with the already written dates set at 20:00:00 the day before?

Zeshan
  • 2,496
  • 3
  • 21
  • 26
ffuentes
  • 1,042
  • 5
  • 16
  • 36
  • Might need to see the code related to the spreadsheet exports. Or are you saying you've corrected the issue but now just need to correct past data? – ficuscr Jul 18 '19 at 20:57
  • I'm not sure if I get you correctly. If you can show some sample data and the desired output, that would be helpful to understand. – Zeshan Jul 18 '19 at 20:57
  • PHP is transforming a date to my timezone: For instance, 2019-07-18 00:00:00 to 2019-07-17 20:00:00. – ffuentes Jul 18 '19 at 20:59
  • If I type now() it's understandable that it uses my timezone but if I insert a date I don't want it to convert it to anything else. – ffuentes Jul 18 '19 at 21:03
  • 1
    Think you are looking for [`DateTune::SetTimezone`](https://www.php.net/manual/en/datetime.settimezone.php). Maybe look at top answer here: https://stackoverflow.com/questions/40912701/datetime-in-php-with-timezone – ficuscr Jul 18 '19 at 21:16

0 Answers0