hi.

say i have two dates:

@DateFrom = 03/03/2015
@DateTO = 03/05/2015

How to get records where Date_Field is between @DateFrom 2:01 PM and @DateTo 2:00 PM?

Thanks.. :) :) :)

Member Avatar for diafol
SELECT ...  WHERE Date_Field BETWEEN @DateFrom AND @DateTO

Which DB are you using?

SQL Server.. i need to include time from @DateFrom and @DateTo.how will i construct the query with time?

my date and time fields are separated:
Date_Processed (date datatype)
Time_Processed (time datatype)

Member Avatar for diafol

It would hep if you showed your table schema in full and all the variables that you intend on using. A datetime datatype may have been more useful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.