Formats the DateTime object using the provided pattern and optional locale.
String format(String pattern, [String? locale]) => DateFormat(pattern, locale).format(this);