Search code examples
phplaravellumenphp-carbon

How to change or manage the "Carbon" timezone so it doesn't move the clock back and forth


I use Laravel and I deployed my application on Docker
I use carbon package for time management and I set the timezone to Asia/Tehran But now I found a problem and the time are moved forward one hour and I don't want this one hour to move forward. Is there a solution for me to move back one hour?

Carbon::now("Asia/Tehran"); //  Asia/Tehran (+04:30)

But i need this

Carbon::now("Asia/Tehran"); //  Asia/Tehran (+03:30)

Solution

  • using timezonedb package solve your issue

    pecl install timezonedb
    

    or simply download and install it https://pecl.php.net/package/timezonedb/

    after install add this line to php.ini

    extension=timezonedb.so