日期问题(0分)

  • 主题发起人 主题发起人 gubing
  • 开始时间 开始时间
G

gubing

Unregistered / Unconfirmed
GUEST, unregistred user!
请问,如何计算两个日期之间的天数。<br>比如2006/03/01和2006/04/01<br>如何计算出两者之间的天数。
 
var<br> &nbsp;Y,M,D,ID : String;<br> &nbsp;i &nbsp; &nbsp; &nbsp; &nbsp;: Integer;<br> &nbsp;c1,c2,c3 : Currency;<br>begin<br> &nbsp;Y:=FormatdateTime('yyyy', Now);<br> &nbsp;M:=FormatdateTime('mm', Now);<br> &nbsp;D:=FormatdateTime('dd', Now);<br> &nbsp;if RadioButton1.Checked then begin<br> &nbsp; &nbsp;ADOQuery1.SQL.Clear;<br> &nbsp; &nbsp;ADOQuery1.SQL.Add('select * from Sell_Main,Sell_Minor '+<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'where Sell_Main.InvoiceID=Sell_Minor.InvoiceID '+<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'and Sell_Main.SellDate &gt;=:A and Sell_Main.SellDate &lt;=:B '+<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'and Sell_Main.Hang Order By Sell_Minor.InvoiceID');<br> &nbsp; &nbsp;ADOQuery1.Parameters.ParamByName('A').Value:=Y+'-'+M+'-'+D+' 00:00:00';<br> &nbsp; &nbsp;ADOQuery1.Parameters.ParamByName('B').Value:=Y+'-'+M+'-'+D+' 23:59:59';<br> &nbsp; &nbsp;ADOQuery1.Open;
 
uses<br> &nbsp;DateUtils;<br>function DaysBetween(const ANow, AThen: TDateTime): Integer;
 
谢谢各位大哥啦!
 
后退
顶部