Skip to content

Instantly share code, notes, and snippets.

@AseemWangoo
Created December 20, 2022 06:20
Show Gist options
  • Save AseemWangoo/a8c4dda4cdfdf5b6f92a125389de902a to your computer and use it in GitHub Desktop.
Save AseemWangoo/a8c4dda4cdfdf5b6f92a125389de902a to your computer and use it in GitHub Desktop.
timezone
const dylibPath='/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation';
final lib = TimeZoneLibrary(DynamicLibrary.open(dylibPath));
final timeZone = NSTimeZone.getLocalTimeZone(lib);
if (timeZone != null) {
print('Timezone name: ${timeZone.name}');
print('Offset: ${timeZone.secondsFromGMT / 60 / 60} hours');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment