formatCurDate function

String formatCurDate (
  1. {String format: "MMDDYYYY",
  2. String divider: "/"}
)

Formats the local current date into a string.

Ex. output is "12/04/2019".

Can be given 'MM' 'DD' and 'YYYY' OR 'YY' in any order for format (ex. 'MMDDYY' 'YYYYDDMM' 'DDYYYYMM' 'MMDD' 'MMYYYY').

Can be given any divider (ex. '/' ':' '.').

Implementation

String formatCurDate({String format = "MMDDYYYY", String divider = "/"}) {
  var now = DateTime.now();
  return formatDate(date: now, format: format, divider: divider);
}