toFormat method

String? toFormat(
  1. String toPattern
)

Implementation

String? toFormat(String toPattern) {
  try {
    return DateFormat(toPattern).format(this);
  } on Exception catch (e) {
    print(e);
    return null;
  }
}