I'm trying to parse date string that looks like this Feb0920221500
(month, day in month, year, hours, minutes). But when I use MMMddyyyyHmm
pattern I always get a FormatException
. Furthermore intl
's DateFormat
fails to parse back a date which it has formatted before:
import 'package:intl/intl.dart';
void main() {
final dateFormat = DateFormat("MMMddyyyyHmm");
final dateString = dateFormat.format(DateTime.now());
print(dateString);
final date = dateFormat.parse(dateString);
print(date);
}
Output:
Feb0920221511
Uncaught Error: FormatException: Trying to read yyyy from Feb0920221511 at position 13
What am I doing wrong?