parseDate method

DateTime? parseDate(
  1. [String template = 'MM/dd/yyyy KK:mm a',
  2. String locale = 'en_US']
)

Creates a DateTime from this DateFormat.template string.

Implementation

DateTime? parseDate([String template = 'MM/dd/yyyy KK:mm a', String locale = 'en_US']) {
  try {
    return DateFormat(template, locale).parse(this);
  } catch (e) {
    return null;
  }
}