How get the abbreviated name of the day of the week in Dart

589

Use 'E' as a date pattern (ABBR_WEEKDAY pattern)

DateFormat(DateFormat.ABBR_WEEKDAY).format(date);

Check this for more info: https://docs.flutter.io/flutter/intl/DateFormat-class.html

Share:
589
Sacha Arbonel
Author by

Sacha Arbonel

Updated on December 25, 2022

Comments

  • Sacha Arbonel
    Sacha Arbonel over 1 year

    Somebody knows how can I extract from DateTime the abbreviated name of the day of the week?

    ej:

    DateTime date = DateTime.now();
    String dateFormat = DateFormat('dd-MM-yyyy hh:mm').format(date);
    

    Result -> Fri