0

I would like to be able to convert a date string like this 'September 23, 2019' to milliseconds in dart

  • 1
    Does this answer your question? [How to get a timestamp in Dart?](https://stackoverflow.com/questions/13110542/how-to-get-a-timestamp-in-dart) – Sami Haddad Aug 21 '20 at 17:05

1 Answers1

1

Try DateTime.parse('September 23, 2019').millisecondsSinceEpoch.

or

var date = 'September 23, 2019';
var dateTimeFormat = DateFormat('MMMM d, yyyy', 'en_US').parse(date);
dateTimeFormat.millisecondsSinceEpoch

Also, someone answered this here -> convert datetime string to datetime object in dart?

Nikhil Kishore
  • 272
  • 3
  • 8