formatStringToIsoDate method

DateTime formatStringToIsoDate()

Parses a date string in the format dd/MM/yyyy and returns a DateTime object.

Example:

final dateString = "03/09/2025";
final date = dateString.formatStringToIsoDate();
print(date); // 2025-09-03 00:00:00.000

Throws a FormatException if the string is not in the expected format.

Implementation

DateTime formatStringToIsoDate() {
  //return DateFormat('dd/MM/yyyy').parse(this); ///PREVIOUS IMPLEMENTATION WITH intl
  return formatInputToDateTime();
}