formatDateTime static method

String formatDateTime({
  1. required String dateTime,
  2. String inFormat = Format.fyyyyMMdd,
  3. String outFormat = Format.fyyyyMMdd,
})

format date and time (String)

Implementation

static String formatDateTime(
    {required String dateTime,
    String inFormat = Format.fyyyyMMdd,
    String outFormat = Format.fyyyyMMdd}) {
  if (_isNullOrEmpty(dateTime)) {
    return "";
  } else {
    return dateTimeToString(
        date: stringToDateTime(date: dateTime, format: inFormat),
        format: outFormat);
  }
}