format method

String format(
  1. String formatStr
)

Returns a string representation of this date with the format provided as a parameter.

Example: DateTime.now().format('yyyy-MM-dd') -> 2023-08-24.

Implementation

String format(String formatStr) => DateFormat(formatStr).format(this);