import 'package:intl/intl.dart';
String now = DateFormat("yyyy-MM-dd").format(DateTime.now());
import 'package:intl/intl.dart';
DateTime now = DateTime.now();
String formattedTime = DateFormat.Hms().format(now);
print(formattedTime);
main() {
var now = new DateTime.now();
var formatter = new DateFormat('yyyy-MM-dd');
String formattedDate = formatter.format(now);
print(formattedDate); // 2016-01-25
}
DateTime now = new DateTime.now();
DateTime date = new DateTime(now.year, now.month, now.day);
DateTime dateToday = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day) ;
dependencies:
flutter:
sdk: flutter
intl: ^0.16.1