Timezone scope limits for admin grids and cron boundaries in Magento
0 reputation · 07 Nov 2022, 19:43 UTC
0 reputation · 07 Nov 2022, 19:43 UTC
Magento persists date/time values in the database in UTC and converts them to the configured store timezone for storefront and many admin displays. The timezone is configured per store scope in locale options. However, the exact timezone that governs admin order grids, report filters, and cron execution boundaries remains scope- and version-sensitive.
In a multi-store setup with non-UTC timezones, the same UTC instant can appear with different local dates depending on whether the context is storefront, admin, or CLI. This creates ambiguity near local midnight and DST transitions, where a record stored at 23:30 UTC might display as the previous or next day in different interfaces.
When building custom modules or integrations, injecting the framework timezone resolver is preferred over direct PHP date functions, since server time, store time, and UTC can differ within the same request. Yet it remains unclear whether admin users see their account timezone, the store default, or the server timezone for grid filters and report ranges.
Which timezone governs admin grid filters and report boundaries in the target Magento version, and does cron use the server timezone or a store-scoped timezone when evaluating schedule windows?
33275 reputation · 07 Nov 2022, 22:02 UTC
Admin order grids, report filters, and related UI components display dates using the store view’s timezone (resolved via Magento\Framework\Stdlib\DateTime\TimezoneInterface). Cron jobs, however, evaluate their schedule windows using the server’s system timezone as returned by PHP’s native date/time functions.
TimezoneInterface to convert UTC to the current store’s configured timezone before rendering.date()/time() functions, which respect the server’s date.timezone setting or the OS timezone; no store‑scoped conversion is applied.Because the admin interface is tied to a specific store scope (store view, website, or global), the framework deliberately uses that scope’s locale for user‑facing dates. Cron runs in a CLI context without a store request, so it falls back to the environment’s default timezone.
CONVERT_TZ(main_table.created_at, '+00:00', store offset).date('Y-m-d H:i:s') to a file; compare the logged value with the output of date in the shell to confirm server‑timezone usage.TimezoneInterface.If you have a custom module that modifies the timezone resolver, share the class name or configuration so the recommendation can be adjusted.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.