Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Aronaman's avatar

Carbon::now() gives wrong date

hey guys

Carbon::now() //date: 2021-09-02 12:00:07.991761 UTC (+00:00)
and on the internet date now time(utc) is 2021-09-02 2:00 AM

IT IS 10 hour behind. note: I don't use any time zone in my php.int file and i try to cache.clean in laravel

0 likes
22 replies
rajeshtva's avatar

may be the time is being taken from your system?

Aronaman's avatar

yea it take from local time and added 7 hour, I checked if I change the local time it also changed. my local time GMT +3. how can I solve it! I am connected the internet, but noting

rajeshtva's avatar

may be your system time update module or hardware is faulty. mine is too. so i have adjusted it manually since then. may be there would be differences of some seconds. but I think for development it would be fine

Sinnbeck's avatar

What if you specify it when calling now()?

now()->setTimezone('utc');
Aronaman's avatar

I try it and it is similar with now();

Aronaman's avatar

I am not in linux. It is in local host. I think the carbon not getting request from internet instead it uses the local time and added 7 hour in my case.

Sinnbeck's avatar

Yeah it uses the system clock. What OS are you running?

Sinnbeck's avatar

.. And that shows the correct time based on you timezone? Check the timezone with Get-TimeZone

Aronaman's avatar

Pacific Standard Time (UTC-08:00) Pacific Time (US & Canada) and my correct time zone is UTC+3, but the datetime time is correct, I think is is b/c I make it manually

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

What does I make it manually mean? Did you override some settings in windows ? Perhaps try just selecting the correct timezone and let windows handle everything for you

2 likes
Aronaman's avatar

Thanks, it working. thanks vey much it is my setting problem

migsAV's avatar

Look for date.timezone in your php.ini file and see what it's set to

Aronaman's avatar

;date.timezone = "UTC" I make it like this on php.int still noting change

Please or to participate in this conversation.