timezone 0.11.0 copy "timezone: ^0.11.0" to clipboard
timezone: ^0.11.0 copied to clipboard

Time zone databases and time zone aware `DateTime`.

example/example.dart

import 'package:timezone/data/latest.dart' as tz;
import 'package:timezone/timezone.dart' as tz;

void main() {
  tz.initializeTimeZones();
  final locations = tz.timeZoneDatabase.locations;
  print(locations.length); // => 429
  print(locations.keys.first); // => "Africa/Abidjan"
  print(locations.keys.last); // => "US/Pacific"

  final detroit = tz.getLocation('America/Detroit');
  final now = tz.TZDateTime.now(detroit);
  print(DateTime.now()); // => 2025-12-18 10:34:02.590478 in GMT+1
  print(now); // => 2025-12-18 04:32:07.515720-0500
  final timeInUtc = DateTime.utc(1995, 1, 1);
  final timeZone = detroit.timeZone(timeInUtc.millisecondsSinceEpoch);
  print(timeZone); // => [EST offset=-18000000 dst=false]
}
553
likes
160
points
1.39M
downloads

Publisher

unverified uploader

Weekly Downloads

Time zone databases and time zone aware `DateTime`.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

http, path

More

Packages that depend on timezone