I think I'd prefer to seperate the date and the time.
WHERE DATE = .... and time between A and B;
In MySQL, for example,
20020905132800 and 020905132800 are interpreted as '2002-09-05 13:28:00' so you could easily seperate the date and time portions using string splitting functions (depending on your implementation) such as LTRIM or whatever.
But my solution of choice would be to use regular experessions (if you dbm supports them) as in
WHERE datetime REGEXP "^20020905"; or WHERE datatime REGEXP "132800$"; These would pull datetimes starting with 20020905 or ending in 132800.
Hope this points you toward a solution. George K
...the foolishness of men! When they are learned they think they are wise.
Sorry, forgot what forum I was In!
In SQL Server you could try
WHERE DATEPART(d, incoming date) = target date day and DATEPART(m, incoming date) = target date month and DATEPART(yyyy, incoming date) = target date year and DATEPART(hh, incoming date) between 6 and 10 ...
hour hh
minute mi, n
second ss, s
millisecond ms
You get the idea.
Again, I hope this helps. George K
...the foolishness of men! When they are learned they think they are wise.
I need to pull between 9/1/02 and 9/15/02 from 7AM to 11PM daily. I am assuming i need 2 statements, one to pull the date, then scrub for time. But I am worried about performance.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.