📜  datetime dart 格式打印 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:02.438000             🧑  作者: Mango

代码示例1
//You can use the intl package https://pub.dev/packages/intl/install

import 'package:intl/intl.dart';

main() {
  final DateTime now = DateTime.now();
  final DateFormat formatter = DateFormat('yyyy-MM-dd');
  final String formatted = formatter.format(now);
  print(formatted); // something like 2013-04-20
}