dateToString static method

String dateToString(
  1. DateTime date, {
  2. String format = "yyyy-MM-dd",
})

Implementation

static String dateToString(DateTime date, {String format = "yyyy-MM-dd"}){
  try {
    return DateFormat(format).format(date);
  }catch(e){
    return dateToString(date);
  }
}