New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

spatie/google-time-zone

Get time zones for coordinates
881,728 108

Larablocks Analysis

Compatibility

Trusted maintainer

spatie/google-time-zone works with Laravel 6 to 13 (latest release 1.3.0, Feb 23, 2026).

Laravel 5 in earlier releases.

  • Trusted maintainer: spatie publishes 287 packages on Larablocks, with 204,136,623 downloads a month between them.

Recommendation checks

Recommended

Recommended by Larablocks: meets all 4 checks.

  • Works with Laravel 13, the current version
  • Released in the last 12 months (Oct 8, 2026)
  • 35,499 downloads a month (at least 10,000)
  • 108 GitHub stars (at least 100)

State

Actively maintained
  • Last stable release: Oct 8, 2026.
  • 3 releases in the last 12 months.
  • First released: Apr 26, 2019.
  • Monthly downloads: 35,499, up 56% from six months ago.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require spatie/google-time-zone
Latest Version:1.3.0
PHP:^7.2|^8.0
Laravel:6 – 13
Older releases:5
License:MIT
Last Updated:Nov 5, 2026
Links: GitHub  ·  Packagist
Maintainer: spatie

Get the time zone used at the given coordinates

Latest Version MIT Licensed run-tests Check & fix styling Total Downloads

This package can convert GPS coordinates to time zones using Google's Time Zone service. Here's a quick example:

GoogleTimeZone::getTimeZoneForCoordinates('51.2194475', '4.4024643');

// Will return this array
[
    "dstOffset" => 0
    "rawOffset" => 3600
    "timeZoneId" => "Europe/Brussels"
    "timeZoneName" => "Central European Standard Time"
]

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install this package through composer.

composer require spatie/google-time-zone

Laravel installation

Though the package works fine in non-Laravel projects we've included some niceties for our fellow Artisans.

In Laravel will autoregister the package itself, but you should still publish the config file yourself.

php artisan vendor:publish --provider="Spatie\GoogleTimeZone\GoogleTimeZoneServiceProvider" --tag="config"

This is the content of the config file:

return [
    /*
     * The api key used when sending timezone requests to Google.
     */
    'key' => env('GOOGLE_MAPS_TIMEZONE_API_KEY', ''),

    /*
     * The language param used to set response translations for textual data.
     *
     * More info: https://developers.google.com/maps/faq#languagesupport
     */
    'language' => '',
];

Usage

Here's how you can get the time zone for a given set of coordinates.

$googleTimeZone = new GoogleTimeZone();

$googleTimeZone->setApiKey(config('google-time-zone.key'));

$googleTimeZone->getTimeZoneForCoordinates('51.2194475', '4.4024643');

/*
// Will return this array
[
    "dstOffset" => 0
    "rawOffset" => 3600
    "timeZoneId" => "Europe/Brussels"
    "timeZoneName" => "Central European Standard Time"
]
*/

You can get the result back in a specific language.

$googleTimeZone
   ->setLanguage('nl')
   ->getTimeZoneForCoordinates('51.2194475', '4.4024643');

/*
// Will return this array
[
      "dstOffset" => 0
      "rawOffset" => 3600
      "timeZoneId" => "Europe/Brussels"
      "timeZoneName" => "Midden-Europese standaardtijd"
]
*/

It is possible to specify a timestamp for the location so that daylight savings can be taken into account. We will set this timestamp to the current time by default.

$googleTimeZone
   ->setTimestamp(new DateTime('13 august 2018'))
   ->getTimeZoneForCoordinates('51.2194475', '4.4024643');

/*
// Will return this array
[
      "dstOffset" => 3600
      "rawOffset" => 3600
      "timeZoneId" => "Europe/Brussels"
      "timeZoneName" => "Central European Summer Time"
]
*/

If you are using the package with Laravel, you can simply call getTimeZoneForCoordinates.

GoogleTimeZone::getTimeZoneForCoordinates('51.2194475', '4.4024643');

/*
// Will return this array
[
    "dstOffset" => 0
    "rawOffset" => 3600
    "timeZoneId" => "Europe/Brussels"
    "timeZoneName" => "Central European Standard Time"
]
*/

When no time zone was found null will be returned.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

spatie/geocoder

Geocoding addresses to coordinates

6,005,370 847
farhanwazir/laravel-map-form-field

Laravel map form field package.

41 1
hugobots/php-geocode

A wrapper around the Google Geocoding API to get different details such as latit...

55,261 2
aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar...

554,386 4,329
farhanwazir/laravelgooglemaps

Laravel Google Map package for 5.x. You can use all google map features in larav...

42,281 150

Version History

Version Released PHP Laravel License
1.3.0 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
1.2.9 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0 MIT
1.2.8 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 MIT
1.2.7 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 MIT
1.2.6 ^7.2|^8.0 ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 MIT