为什么要这样??
这样行吗?
var
year,Month,day: Word;
qDate: TDate;
begin
DecodeDate(Now, year, Month, day);
qDate := EncodeDate(year, month, day);
showmessage(DatetimeTostr(qDate));
这样行吗?
var
year,Month,day: Word;
qDate: TDate;
begin
DecodeDate(Now, year, Month, day);
qDate := EncodeDate(year, month, day);
showmessage(DatetimeTostr(qDate));
解决方案 »
- indy的idTcpServer WriteBuffer 有内存泄露?
- 喜欢[僵哥]是不变的事实
- Delphi预想不到的代码
- 怎么复制sql表中的数据
- 关于动态生成页面的问题,我需要在数据库检索出相应的内容,根据内容的多少。。。
- 在线急等-50求 怎么获得一个窗口(例如IE)的标题栏的left,top,height,width啊
- 超菜问题
- WARNING.Duplicate resource(s);为何会报这个错 应该着么解决
- (ado连库adoquery查询)label控件可以显示数据库中的字段内容吗? 怎样实现?怎样只显示一条记录内容(不用grid件,自己做显示界面)?
- 如何在数据库中加图像字段?
- Get sysmenu\append sysmenu
- 源程序
//时间自动设为00:00:00,从数据库中调出时,将忽略该时间。
把时间整成0:0:0看行不行?
begin
DecodeDate(datetimepicker4.date,Year,Month,Day);
Table1.Fields[1].AsDateTime:=EncodeDate(Year,Month,Day);//save Date,not Time
end;
table1.FieldByName('时间').asdatetime:=formatdatetime('yyyy-mm-dd',datetimepicker4.datetime); ______OK!!!
不然取NOW的值也行
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TDateTime rq=Now();
rq=(TDateTime)((int)rq); // 取整
ShowMessage(rq);
}
这是C++BUILDER
的办法,改成DELPHI就行了
结果:时间没有了,实际是 0:0
只需在FormCreate事件中写上(datetimepicker4.datetime:=Date;),然后程序中不论何时取
table1.FieldByName('时间').asdatetime:=datetimepicker4.date,均不含时间.
我用以下语句会出现错误
table1.edit;
table1.FieldByName('出生年月').asdatetime:=formatdatetime('yyyy-mm-dd',datetimepicker1.datetime);错误信息.
[Error] input1.pas(662): Incompatible types: 'TDateTime' and 'String'
怎样解决?
我用以下语句会出现错误
table1.edit;
table1.FieldByName('出生年月').asdatetime:=formatdatetime('yyyy-mm-dd',datetimepicker1.datetime);错误信息.
[Error] input1.pas(662): Incompatible types: 'TDateTime' and 'String'
怎样解决?
你们肯定是错了;
我已经提了,只要对日期取整,时间变没有了,
TDateTime rq=Now();
rq=(TDateTime)((int)rq); // 日期取整
ShowMessage(rq);
C++这么简单,DELPHI肯定也很简单
不过要改一下:
table1.FieldByName('时间').asstring:=formatdatetime('yyyy-mm-dd',datetimepicker4.datetime);