I want to change the default date picker date format. The default format of date picker is "MM/DD/YYYY". But i want "DD/MM/YYYY".
Asked
Active
Viewed 1,464 times
2 Answers
2
you can do this by updating your apps (or just the widgets) locale:
await showDatePicker(locale: const Locale('de'));
'de'
for germany, but pick whatever countryCode you require.
-
Don't you need to specify MaterializationDelegates in your root MaterialApp widget? Or is this optional? MaterializationDelegates are; localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], – berkaykurkcu May 19 '23 at 20:01
1
so in order to display the date format. for e.g:
Text( '${DateFormat.yMd().format(_selectedDate)}'),
check out DateFormat docs at https://api.flutter.dev/flutter/intl/DateFormat-class.html for your format .

Rex
- 250
- 1
- 3
- 18