【问题标题】:How to find the total month between two date and also find the number of days in each month [duplicate]如何找到两个日期之间的总月份以及每个月的天数[重复]
【发布时间】:2019-06-12 07:55:17
【问题描述】:

我想要在我的应用程序中输出图像

在最后一个日期我想要总天数

【问题讨论】:

  • 到目前为止你尝试了什么?

标签: c# asp.net date


【解决方案1】:
int days = DateTime.DaysInMonth(year, month);

【讨论】:

  • 我想你忘记了问题的第一部分,即获取两个日期之间的月数,这可以通过 ((date1.Year - date2.Year) * 12) + date1 来完成。月 - date2.Month
  • 谢谢先生,我已经创建了相同的逻辑
猜你喜欢
  • 1970-01-01
  • 2022-01-19
  • 1970-01-01
  • 1970-01-01
  • 2019-04-12
  • 1970-01-01
  • 1970-01-01
  • 2019-03-28
相关资源
最近更新 更多