Reputation: 559
I have formatted the date in flutter with specific format like "01-Jan-2000", Now How can I convert it back to the DateTime in flutter?
Upvotes: 0
Views: 738
Reputation: 3405
Try this package, Jiffy. You can solve this in one line of code
DateTime dateTime = Jiffy.parse("01-Jan-2000", pattern: "dd-MMM-yyyy").dateTime;
Upvotes: 0
Reputation: 10963
Use DateFormat
like this:
DateFormat dateFormat = DateFormat("dd-MMM-yyyy");
DateTime dateTime = dateFormat.parse("01-Jan-2000");
Upvotes: 1