fork download
  1. void main() {
  2. final now = DateTime.now(); // local time
  3. final offset = now.timeZoneOffset; // Duration
  4.  
  5. print('Local time: $now');
  6. print('UTC offset (hours): ${offset.inHours}');
  7. print('UTC offset (minutes): ${offset.inMinutes}');
  8. }
  9.  
Success #stdin #stdout 1.2s 127920KB
stdin
Standard input is empty
stdout
Local time: 2026-01-06 19:54:54.437085
UTC offset (hours): 0
UTC offset (minutes): 0