You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
461 B

  1. import 'package:intl/date_symbol_data_local.dart';
  2. import 'package:intl/intl.dart';
  3. const String DD_MM_YYYY = 'dd/MM/yyyy';
  4. extension DateTimeExtension on DateTime {
  5. /// Return a string representing [date] formatted according to our locale
  6. String format([String pattern = DD_MM_YYYY, String? locale]) {
  7. if (locale != null && locale.isNotEmpty) {
  8. initializeDateFormatting(locale);
  9. }
  10. return DateFormat(pattern, locale).format(this);
  11. }
  12. }