📜  如何在 dart 中减去两个日期 - C# 代码示例

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

代码示例1
int daysBetween(DateTime from, DateTime to) {
     from = DateTime(from.year, from.month, from.day);
     to = DateTime(to.year, to.month, to.day);
   return (to.difference(from).inHours / 24).round();
   //Using inHours instead of days b/c of daylight savings
  }

   //the birthday's date
   final birthday = DateTime(1967, 10, 12);
   final date2 = DateTime.now();
   final difference = daysBetween(birthday, date2);