我想取出两个我想取出DateTimePicker中选取的日期,然后通过处理,得到在这两个时间之间的时间,例如:我在一个DateTimePicker中选取了2003-8-2另外一个DateTimePicker中选了2003-7-30,这时,我可以得到2003-8-2、2003-8-1、2003-7-31、2003-7-30、怎么实现啊?有没有比较好的方法?
还有就是DateTimePicker中通过dateToStr(DateTimePicker1.date)取出的时间是2003-8-2,有没有什么好的函数之类的能使格式变为2003802呢?要不我就要自己建立一个过程来处理了!希望高手指教!谢谢!
还有就是DateTimePicker中通过dateToStr(DateTimePicker1.date)取出的时间是2003-8-2,有没有什么好的函数之类的能使格式变为2003802呢?要不我就要自己建立一个过程来处理了!希望高手指教!谢谢!
var Days,i : integer ;
begin
Days :=StrToint(Format('%12.0f',[(abs(DateTimePicker1.DateTime - DateTimePicker2.DateTime))])) ;
Label1.Caption := '';
For i :=1 to abs(Days) do
begin
if DateTimePicker1.DateTime < DateTimePicker2.DateTime then
Label1.Caption := Label1.Caption + #13 +FormatDateTime('yyyymmdd',DateTimePicker1.Date+i)
else
Label1.Caption := Label1.Caption + #13 +FormatDateTime('yyyymmdd',DateTimePicker2.Date+i) ;
end ;
if DateTimePicker1.DateTime < DateTimePicker2.DateTime then
Label1.Caption := #13 +FormatDateTime('yyyymmdd',DateTimePicker1.Date)+ Label1.Caption
else
Label1.Caption := #13 +FormatDateTime('yyyymmdd',DateTimePicker2.Date)+ Label1.Caption ;
end;
可将Label1.Caption 改为一个时间数组
二、
FormatDateTime('yyyymmdd',DateTimePicker2.Date)