Created
March 7, 2023 15:48
-
-
Save zombie6888/bc9be50b29b131b7b42d8810dd27f38e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final now = DateTime.now(); | |
final offset = now.timeZoneOffset; | |
final negativeDuration = Duration(hours: -3); | |
final duration = negativeDuration; | |
print(offset.isNegative); | |
print(negativeDuration.isNegative); | |
final date = DateTime.parse('2023-03-07 10:00').subtract(duration); | |
final utcDate = date.toLocal().toLocal().copyWith(isUtc: true).toIso8601String(); | |
print(utcDate); | |
print(DateTime.parse(utcDate).toLocal()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment