<%
dim datetime,tyear,tmonth,tday,ftime,ltime
datetime = date()
tyear = year(datetime)
tmonth = month(datetime)
ftime = tyear & "-01-01"
select case tmonth
case 1,3,5,7,8,10,12
tday = 31
case 4,6,9,11
tday = 30
case 2
if (tyear mod 4 =0 and tyear mod 100 <>0 and tyear mod 400 = 0) then
tday = 29
else
tday = 28
end if
end select
ltime = tyear & "-" & tmonth & "-" & tday
'access
sql = "select * from table where datetime between #" & ftime & "# and #" & ltime & "#"
'mssql
sql = "select * from table where datetime between '" & ftime & "' and '" & ltime & "'"