📅  最后修改于: 2022-03-11 14:44:54.589000             🧑  作者: Mango
//add, intl Flutter package
DateTime datetime = DateTime.now();
print(datetime.toString());
//output: 2021-10-17 20:04:17.118089
String datetime1 = DateFormat("yyyy-MM-dd").format(datetime);
print(datetime1);
//output: 2021-10-17
String datetime2 = DateFormat.Hms().format(datetime);
print(datetime2);
//output (Time): 20:04:17
String datetime3 = DateFormat.MMMMEEEEd().format(datetime);
print(datetime3);
//output: Sunday, October 17