dependencies:
intl: ^0.17.0
import 'package:intl/intl.dart';
DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm:ss");
String string = dateFormat.format(DateTime.now()); //Converting DateTime object to String
DateTime dateTime = dateFormat.parse("2019-07-19 8:40:23"); //Converting String to DateTime object
var dateTime = DateTime.parse("dateTimeString");
DateTime tempDate = new DateFormat("yyyy-MM-dd hh:mm:ss").parse(savedDateString);
import 'package:intl/intl.dart';
...
var dmyString = '23/4/1999';
var dateTime1 = DateFormat('d/M/y').parse(dmyString);
var mdyString = '04/23/99';
var dateTime2 = DateFormat('MM/dd/yy').parse(mdyString);
var mdyFullString = 'April 23, 1999';
var dateTime3 = DateFormat('MMMM d, y', 'en_US').parse(mdyFullString));
DateTime.parse("string date here");
import 'package:intl/intl.dart';
String? convertiEnDateEtHeure(n) {
String date = DateFormat.yMMMd().add_Hm().format(n);
return date;
}
TimeOfDay _startTime = TimeOfDay(hour:int.parse(s.split(":")[0]),minute: int.parse(s.split(":")[1]));