import 'package:intl/intl.dart';
DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(now);
Add this Package or click on the sourse
https://pub.dev/packages/intl
import 'package:intl/intl.dart';
var year = DateFormat('yyyy').format(DateTime.now());
print(berlinWallFell.year); // 1989
print(berlinWallFell.month); // 11
print(berlinWallFell.day); // 9
print(moonLanding.hour); // 20
print(moonLanding.minute); // 18
$ flutter pub add syncfusion_flutter_datepicker
DateFormat dateFormat = DateFormat("dd/MM/yyyy HH:mm:ss");