Carbon::now() is not using UTC

Carbon::now() is not using UTC

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Carbon::now() is not using UTC

You might expect Carbon::now() to always return the current time in Coordinated Universal Time, especially if your Laravel configuration explicitly sets 'timezone' => 'UTC' in config/app.php. However, based on reports from developers in the Philippines observing a 12-hour discrepancy, this expectation is often misplaced. When logging a request at 9:00 PM Philippine time, the application records 21:00:00 instead of the expected UTC equivalent of 13:00:00. This behavior stems from how PHP's Carbon library interacts with your server's local environment versus your configuration settings.

The core issue lies in the distinction between the "Carbon timezone" and the "System timezone." While setting 'timezone' => 'UTC' in your Laravel config tells the Date facade and many helpers to use UTC, the underlying PHP function date_default_timezone_get() often reflects your server's actual hardware clock zone unless explicitly overridden at runtime.

When you call Carbon::now(), the library checks for a timezone. If no specific timezone is passed as an argument (e.g., Carbon::now('UTC')), Carbon defaults to using the system's local timezone detected via PHP's date_default_timezone_get(). It does not automatically ignore your .env or config/app.php settings unless you are using a specific helper like now() which respects the config, but Carbon::now() itself is strict about its default behavior.

To understand why this happens, consider how the PHP runtime initializes. When your server boots up, it loads the timezone configuration from the system's php.ini or an .env variable like APP_TIMEZONE. If your hosting provider or your local machine is set to Asia/Manila, PHP will return that as the default timezone. Consequently, when Carbon::now() runs without a second argument, it effectively becomes Carbon::now('Asia/Manila').

The fix requires an explicit instruction within the code itself. You must pass the desired timezone directly to the constructor or the method call. The corrected line should look like this:

$log->dateRequest = Carbon::now('UTC');

By explicitly passing 'UTC', you bypass the system's default timezone detection entirely. This ensures that regardless of whether your server is running in Tokyo, Manila, or London, the timestamp recorded will always be relative to the Prime Meridian.

There is a common misconception that setting timezone in config/app.php globally overrides every Carbon call. While this config file drives the behavior of Laravel's own time helpers (like $this->now() within Eloquent scopes or specific Laravel utilities), the static Carbon::now() method adheres to standard PHP conventions where it defaults to the system timezone unless told otherwise.

This distinction is critical for data integrity in distributed systems. If your application logs timestamps based on server location, a request initiated by a user in New York might hit a server in Singapore. Without explicit UTC handling, the log entry would reflect Singapore time, making it difficult to correlate events across different regions or calculate precise latency against external APIs that expect ISO 8601 UTC strings.

If you are debugging this further, you can verify what timezone Carbon is actually using by running:

use Illuminate\Support\Carbon;

echo Carbon::now()->timezone; // Will output 'Asia/Manila' if not specified
echo Carbon::now('UTC')->timezone; // Will output 'UTC'

It is also worth noting that while UTC is the standard for database storage and API responses, your application's UI layer should still respect the user's local timezone when displaying dates. You might store 2023-10-27 13:00:00 in UTC but convert it to the user's local time only at the moment of rendering.

For more complex scenarios involving time zones, consider leveraging Laravel's built-in helpers which are designed to respect your timezone configuration out of the box, such as using now() directly instead of instantiating the Carbon class without arguments. However, if you require manual control over the timestamp source, explicit timezone specification remains the most reliable approach.

Our network