formatDate method

String formatDate({
  1. String format = 'yyyy-MM-ddTHH:mm:ssZ',
  2. String to = 'dd MMM yyyy',
  3. int addHours = 0,
})

Implementation

String formatDate({String format = 'yyyy-MM-ddTHH:mm:ssZ', String to = 'dd MMM yyyy', int addHours = 0}) {
  String output;
  try {
    output = (toDateEx(format: format).add(addHours.hours)).toStringEx(format: to);
  } catch (e) {
    logE(e.toString());
    output = 'error';
  }
  return output;
}