toFormattedString method

String toFormattedString([
  1. String? newPattern
])

converts DateTime to yyyy-MM-dd format or new pattern as wish

Implementation

String toFormattedString([String? newPattern]) {
  return DateFormat(newPattern ?? "yyyy-MM-dd").format(this);
}