Flutter Datetime Format
import 'package:intl/intl.dart';
DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(now);
S.Mahdi
import 'package:intl/intl.dart';
DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(now);
@override
void initState() {
super.initState();
initializeDateFormatting();
}
Format Pattern Result
-------------- -------
'EEE, MMM d, ''yy' Wed, Jul 10, '96
'h:mm a' 12:08 PM
'yyyyy.MMMMM.dd GGG hh:mm aaa' 01996.July.10 AD 12:08 PM