Formatting DateTime as RFC-3339 for RSS Feed

When I print mine DateTimewithmyDate.toIso8601String();

he prints

2015-11-15T11: 55: 32,250

Which is not verified with the online check I tried. The spectrum says that it should be in one of the following formats:

2002-10-02T10: 00: 00-05: 00

2002-10-02T15: 00: 00Z

2002-10-02T15: 00: 00.05Z

I could try adding Zin the end, but it seems hacked. Is there a way to print DateTimein Dart so that it matches one of the following formats?

+4
source share
1 answer

Zfor UTC. You will get it if you convert DateTime to UTC with

new DateTime.toUtc().toIso8601String();

Try it in DartPad

+2

Source: https://habr.com/ru/post/1615972/


All Articles