Convert datetime to ticks and compare the ticks Check out this, http://www.codeproject.com/KB/database/DateTimeToTicks.aspx
On Thu, Jul 29, 2010 at 1:34 PM, Jeena Ajiesh <[email protected]> wrote: > *Thanks for the reply,I tried all the option, but no use* > ** > *Am Using Sql Server,* > *I tried in Greater than, less than option too. but its not getting > correctly.* > *All values bettween that date is displayed. i need to check the time > also.wen im entering a datetime, its only checking date.* > *Any other options?* > > *Thanks....* > * * > > > On Wed, Jul 28, 2010 at 1:34 PM, Benj Nunez <[email protected]> wrote: > >> What kind of database are you using (Access/Sql Server/DB2) ? >> >> The correct way of using the BETWEEN clause is: >> >> SELECT column_name(s) >> FROM table_name >> WHERE column_name >> BETWEEN value1 AND value2 >> >> >> >> Regards, >> >> >> >> Benj >> >> >> >> >> >> >> >> >> >> >> On Jul 28, 4:32 pm, Jeena Ajiesh <[email protected]> wrote: >> > *Dear friends,* >> > ** >> > *im stucked in a problem.* >> > *in database im having fromdate,todate, message and id* >> > *fromdate & todate contains dates with time.* >> > ** >> > *Eg in DB:Fromdate >> > Todate Message Id * >> > * 7/25/2010 10:00:00 AM 8/1/2010 12:00:00 PM >> > Test abc* >> > * 7/25/2010 9:00:00 PM 8/1/2010 10:00:00 PM >> > Hello abc* >> > ** >> > *Im passing a date 7/29/2010 9:15:00 PM.So i need to get the message >> from >> > table as 'Hello'* >> > ** >> > *i tried a query SELECT MESSAGE FROM TABLENAME WHERE '7/29/2010 9:15:00 >> PM >> > BETWEEN FROMDATE AND TODATE* >> > *Can u please help in giving a correct query to retrieve the correct >> message >> > in DB based on the datetime passing.* >> > ** >> > ** >> > **************** >> > **Thanks & Regards, >> > Jeena Ajiesh >> > * > > > > > -- > **************** > **Thanks & Regards, > Jeena Ajiesh > Email: [email protected] > [email protected]* > >
