|
  
- 帖子
- 2
- 精华
- 0
- 积分
- 22503
- 威望
- 0
- IT币
- 22502
|
1#
发表于 2009-3-4 13:42
| 只看该作者
ComboBox自定义取每个月的月末
void __fastcall TDataLoad01Form::FormShow(TObject *Sender)
{
AnsiString StrLastDate="";
Word Year, Month, Day;
DecodeDate(Date(), Year, Month, Day);
TDateTime dtDate = StrToDate(IntToStr(Year)+"-"+IntToStr(Month)+"-"+"01");
ComboBox1->Clear();
for(int i=0;i<12;i++)
{
StrLastDate=DateToStr(dtDate-1);
//ComboBox1->Items->Add(StrLastDate);
DecodeDate(StrLastDate, Year, Month, Day);
dtDate = StrToDate(IntToStr(Year)+"-"+IntToStr(Month)+"-"+"01");
//ShowMessage(StrLastDate);
ComboBox1->Items->Add(StrLastDate);
}
ComboBox1->ItemIndex=0;
}
cutoff_date = to_date('" +ComboBox1->Text+"','yyyy-mm-dd') |
|