0

im in laravel 8 and my config.php is :

    'timezone' => 'Asia/Tehran',

now the DST ( Daylight Saving Time ) is disabled in my country ( Iran ). but Carbon in Laravel Show it with DST what is solution

IMSoP
  • 89,526
  • 13
  • 117
  • 169
Behzad
  • 47
  • 1
  • 8
  • 1
    PHP uses a timezone database - maybe this is outdated? – Nico Haase Apr 16 '23 at 17:45
  • Does this answer your question? [Custom time zone in PHP/Laravel](https://stackoverflow.com/questions/75806668/custom-time-zone-in-php-laravel) or the older linked question [How to update timezonedb in PHP (updating timezones info)?](https://stackoverflow.com/questions/3564478/how-to-update-timezonedb-in-php-updating-timezones-info) – IMSoP Apr 16 '23 at 17:46
  • In most Linux distributions, OS updates provide the latest version of the [zoneinfo](https://www.iana.org/time-zones) database. It was updated most recently on 28-March-2023, and its maintainers work hard to incorporate temporopolitical changes like your recent one in Iran. php uses it, so it must nt be up-to-date on your machine.If you [edit] your question to tell us what OS you use, we may have more specific advice for you. – O. Jones Apr 16 '23 at 17:53
  • @O.Jones debian – Behzad May 16 '23 at 08:31

1 Answers1

-1

you should first add this to your app.php (config file)

'disable_carbon_auto_create_timezone' => true,

then add the mentioned code to the app.php (config file)

'timezone' => 'Asia/Tehran',

please make sure to run

php artisan config:clear

this should work for you

Nothingbutageek
  • 357
  • 1
  • 11