How to convert "Wed Sep 07 11:11:19 GMT+05:30 2022" String to DateTime object in Flutter?

Viewed 23

I'm using intl package to format the String.

import 'package:intl/intl.dart';

...

String date = "Wed Sep 07 11:11:19 GMT+05:30 2022";
DateFormat formatter = DateFormat("EEE MMM dd HH:mm:ss zXXX yyyy");
DateTime formattedDateTime = formatter.parse(date);

But getting an Exception

FormatException: Trying to read XXX from Wed Sep 07 11:11:19 GMT+05:30 2022 at position 24

Tested the date format with this tool.

0 Answers
Related