How to get dates from date to to date in MS-ACCESS and JSP? -


this query:

string query1="select * demand_register payment_date> ='"+fromdate+"' , payment_date<='"+todate+"' " ;

if todate=23/6/2011 , fromdate=25/6/2011 retrieves data of dates 24 , 25 not 23? if todate=23/6/2011 , fromdate=23/6/2011 retrieves nothing.

thanks in advance.

dates in access/jet/ace stored not text representation double, integer part day since 12/30/1899 , decimal part time. dates have time portion.

if have been using now() populate field in question, or otherwise storing time part other 0 in field, won't exact match. instead, you'll have use this:

  todate>=#23/6/2011# , todate<#24/6/2011# , fromdate>=#25/6/2011# , fromdate<#26/6/2011# 

this include todate values day 23/6/2011 have time portion.

now, question why including time part other 0 in fields name todate , fromdate -- if dates, should have time part. if you're populating dates in access or via jet/ace sql, can use date() function, returns date part, instead of now(), returns current date , time.

to fix data has time values when should date values, run update change fields integer value, e.g., set todate = int(todate).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -