tz_datetime 1.2.0 copy "tz_datetime: ^1.2.0" to clipboard
tz_datetime: ^1.2.0 copied to clipboard

A Dart package for handling time zoned datetime using native platform implementations

example/example.dart

import 'package:tz_datetime/tz_datetime.dart';

void main() {
  final la = 'America/Los_Angeles';
  final ny = 'America/New_York';

  // Retrieve all available zones from the platform
  final zones = TzDatetime.getAvailableTimezones();
  print(zones); // [Africa/Abidjan, Europe/Athens, ...]

  final laTime = TzDatetime(la, 2026, 2, 9, 3, 17, 3, 964, 38);
  print(laTime); // 2026-02-09 03:17:03.964038-0800

  // Get offset from any date with Daylight Saving Times
  final offset = TzDatetime.getOffset(laTime, la);
  print(offset); // -8:00:00.000000

  final nyTime = TzDatetime.from(laTime, ny);
  print(nyTime); // 2026-02-09 06:17:03.964038-0500

  // Current date time in `la` zone
  print(TzDatetime.now(la));
}
5
likes
160
points
50
downloads

Documentation

API reference

Publisher

verified publishercow-level.ovh

Weekly Downloads

A Dart package for handling time zoned datetime using native platform implementations

Repository (GitHub)
View/report issues

Topics

#timezone #iana #date #datetime

License

BSD-2-Clause (license)

More

Packages that depend on tz_datetime