C# 如何生成日期付款日期
我正在做一个物业管理申请。我有一个带列的C# 如何生成日期付款日期,c#,sql,C#,Sql,我正在做一个物业管理申请。我有一个带列的payment表 accountId, startPaymentDate, NextPaymentDate, EndPaymentDate, CurrentPaymentDate 我面临的挑战是生成NextPaymentDate 此NextPaymentDate在CurrentPaymentDate之后立即生成,并且是每月一次。例如,如果当前付款日期为2017年4月1日,则应将下一行的表更新为2017年5月1日的accountId和NextPayment
payment
表
accountId, startPaymentDate, NextPaymentDate, EndPaymentDate, CurrentPaymentDate
我面临的挑战是生成NextPaymentDate
此NextPaymentDate
在CurrentPaymentDate
之后立即生成,并且是每月一次。例如,如果当前付款日期为2017年4月1日,则应将下一行的表更新为2017年5月1日的accountId
和NextPaymentDate
谢谢假设
CurrentPaymentDate
的数据类型是DateTime
,并且您使用的日期格式是dd/MM/yyyy,您应该能够使用以下格式:
NextPaymentDate = CurrentPaymentDate.AddMonths(1);
好吧,那你觉得哪一点困难?您只需要在CurrentPaymentDate中添加一个月吗?我需要从CurrentPaymentDate中获取下一个付款日期,所以听起来您只需要添加一个月,对吗?谢谢。从你的观点来看,我对如何解决这个问题有了一个想法。只需使用DATEADD函数将一个月添加到currentPaymentDate即可获得下一个PaymentDate。