如何单位取得系统时间的年月日?我还有一个问题请教:那就是我操作access数据库
的时候,我有一个字段是时间型的,但我利用这个字段查询东西的时候,怎么也查不到东西。
q1.SQL.Add('select sum(money) as aa from moneyin where time>'+(year1.Text+'-'+month1.Text+'-'+day1.Text)+' and time<'+(year2.Text+'-'+month2.Text+'-'+day2.Text));我的语句是这样写的其中year1.Text+'-'+month1.Text+'-'+day1.Text和year2.Text+'-'+month2.Text+'-'+day2.Text分别组成了个时间,与数据库中time存储的格式是一样的。我想让这个语句查到东西!请指教!
的时候,我有一个字段是时间型的,但我利用这个字段查询东西的时候,怎么也查不到东西。
q1.SQL.Add('select sum(money) as aa from moneyin where time>'+(year1.Text+'-'+month1.Text+'-'+day1.Text)+' and time<'+(year2.Text+'-'+month2.Text+'-'+day2.Text));我的语句是这样写的其中year1.Text+'-'+month1.Text+'-'+day1.Text和year2.Text+'-'+month2.Text+'-'+day2.Text分别组成了个时间,与数据库中time存储的格式是一样的。我想让这个语句查到东西!请指教!
解决方案 »
- 有用过dspack做过视频采集采集的吗?如何切换采集卡的视频通道?
- 生成xml文件,因过大而出现的问题
- 凑热闹,恭喜 cc 也祝:没有的赶快找,找到的赶紧办事,已经办事的 赶紧要孩子
- 请推荐几本详细介绍OLEContainer处理word文档的教材
- 请问如何获取ListBox中被点击项目的Text?
- delphi连ACCESS怎么连,具体点。
- 大侠们救命,如何在dwg文件 中添加文字或另一张dwg图
- ***急!!如何在DBGRID中不同的行显示不同的颜色***
- 紧急求助!IBLocal的用户名和密码??
- 高价求助,请高手编写程序或者修改服务器数据.绝非广告.请有能力者进来看.
- RichEdit的简单问题!在线等待!
- 求救:如何获取CPU的序列号?
Y, M, D: Word;DecodeDate(Date, Y, M, D);
专门得到年月日,还有时分秒的
var
Year,Month,Day : Word;
begin
DecodeDate(D,Year,Month,Day);
Result:=Year;
end;function GetMonth(D: TDateTime): Integer;
var
Year,Month,Day : Word;
begin
DecodeDate(D,Year,Month,Day);
Result:=Month;
end;function GetDay(D: TDateTime): Integer;
var
Year,Month,Day : Word;
begin
DecodeDate(D,Year,Month,Day);
Result:=Day;
end;
ss: TDateTime;
CYear, Cmonth, CDate: word;
MAX: integer;
begin
ss := now;
decodedate(ss, cyear, Cmonth, CDate);
access数据库查询时间类型的应该用'#'将时间引起来。