时间比较为什么不生效?
#define DEF_OPEN_TIME “9:00:00”
if (pForm3->DateTimePicker2->Time.TimeString() <= DEF_OPEN_TIME)
{
ShowMessage("dd");
}
else
{
ShowMessage("oo");
}
为什么时间框选9点之前,还是显示oo?
[解决办法]
#define DEF_OPEN_TIME "9:00:00"void __fastcall TForm1::Button4Click(TObject *Sender){ DateTimePicker1->Date = 0; if (DateTimePicker1->Time <= StrToTime(DEF_OPEN_TIME)) { ShowMessage("dd"); } else { ShowMessage("oo"); }}