I am new to flutter and my rest api takes current timezone as Europe/london. I don't know to get current timezone in flutter. There is a question in stackoverflow about this topic but no user gave the answer.
Flutter Timezone (as ZoneId)
Can anyone guide me, how can i get the current timezone in flutter using dart.
DateTime
is the default class give use timezone and time offset both required to solve timezone related issue.
DateTime dateTime = DateTime.now(); print(dateTime.timeZoneName); print(dateTime.timeZoneOffset);
Output:
1. India
timeZoneName: IST timeZoneOffset: 5:30:00.000000
2. America/Los_Angeles
timeZoneName: PST timeZoneOffset: -8:00:00.000000
timezone list: https://help.syncfusion.com/flutter/calendar/timezone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With