How to display UTC time in local time

Dart has inbuilt DateTime type that provides quite a few handy methods to convert between time formats.

void main() {
  var utc = DateTime.parse("2020-06-11 17:47:35 Z");
  print(utc.toString());             // 2020-06-11 17:47:35.000Z
  print(utc.isUtc.toString());       // true
  print(utc.toLocal().toString());   //2020-06-11 23:17:35.000

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top