是ACCESS数据想查询从3月11日到9月12日的过生日的客户,起始日期和终止日期是DATETIMEPICKER1,只带“月-日”的格式
解决方案 »
- 请教delphi中关于Web Services的问题
- tquery有关问题
- Field为datetime或smalldatetime类型时,在DBEdit中输入10:20后,失去焦点,就会变成1899-12-30 10:20:00,要得到10:10格式的时间,怎么
- 请问DEC()INC()的作用~
- 初学者的3问题
- 怎样返回字符串中特定字符的个数
- 出现必须加载Dll的错误怎么办??????????????
- 怎样获得文件大小?还有谁知道一个文本文件有没有容量上限?
- 用DELPHI存放资料在哪种数据库文件中最好? + + +
- 本科(计算机)刚毕业,到哪儿找工作比较有前途!
- 刚刚了解电力负荷控制方面的知识,有很多问题无以解答,请求帮助!!!!
- 数据库内存表问题。。。
Unit
DateUtilsCategory
date/time routinesfunction DayOf(const AValue: TDateTime): Word;DescriptionCall DayOf to obtain the day of the month represented by a specified TDateTime value. DayOf returns a value between 1 and 31.Note: DayOf returns the same value as the DayOfTheMonth function.Sql中用month(date) 和 day(date)
select * from 表 where datetime between #'+'1900-'+formatdatetime( "MM-dd ",datetimepicker1.datetime)+'# and #'+formatdatetime('YYYY',Now)+'-'+formatdatetime( "MM-dd ",datetimepicker2.datetime)+'#';
//这个会把所有的生日都列出,因为所有人的生日都在1900到2007年之间。
select * from 表 where datetime between # "+ "1900- "+formatdatetime( "MM-dd ",datetimepicker1.datetime)+ "# and # "+formatdatetime( "YYYY ",Now)+ "- "+formatdatetime( "MM-dd ",datetimepicker2.datetime)+ "# ";
我的意思应该是日期只带月和日的那种,如果加上年了就不会准确。
有没有这样的函数提取月和日的,如1998-10-12,能直接提取"10-12"
查每个月前10天的
begin
with ADOQuery1 do
begin
Close;
SQL.Text := 'SELECT * FROM Table1 where Format(Birthday, ''mm-dd'') between :p1 and :p2';
Parameters.ParamByName('p1').Value := FormatDateTime('MM-DD', DateTimePicker1.Date);
Parameters.ParamByName('p2').Value := FormatDateTime('MM-DD', DateTimePicker2.Date);
Open;
end;
end;