View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Relative time in SQL


Sorry, I wasn't aware that the Now function on a database server always
resolved to 7 AM. Thanks for the heads up although that seems kind of
buggy.

--
Regards,
Tom Ogilvy


"Jamie Collins" wrote in message
om...
"Tom Ogilvy" wrote in ...

the basic approach would be

" . . . where StartTime = '" & Format(Data-1,"mm/dd/yyyy") & "

07:00:00'
and StartTime <= '" & Format(date,"mm/dd/yyyy") & " 07:00:00'"

You would have to insure the format is consistent with what you database
accepts.


It more usual to use the date/time on the database server rather than
use a value from the client e.g. for Jet:

SELECT MyDateTimeCol
FROM MyTable
WHERE MyDateTimeCol NOW()-1
AND MyDateTimeCol <= NOW()
;

Jamie.

--