pDateTimeToString static method

String pDateTimeToString(
  1. DateTime? dateTime, {
  2. String? defaultValue,
  3. String? localization,
})

Implementation

static String pDateTimeToString(DateTime? dateTime,
    {String? defaultValue, String? localization}) {
  try {
    if (dateTime == null) {
      return defaultValue ?? '';
    }
    String formatted =
        pDateTimeFormatter(localization: localization).format(dateTime);
    return formatted;
  } catch (e) {
    if (kDebugMode) {
      print(e.toString());
    }
    return '00-00-0000';
  }
}