Check out example codes for "flutter datetime format". It will help you in understanding the concepts better.

Code Example 1

import 'package:intl/intl.dart';

DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(now);

Learn ReactJs, React Native from akashmittal.com