Subject RE: [firebird-support] Re: Select statement with Date
Author paul
Hi,
Thanks, my logout field is Timestamp.
I want to compare only date value in the
Timestamp field. How to do it.
Say, I got Timestamp field with 07/06/2004 15:54:00
I got date 07/06/2004 00:00:00
How to do the date comparion between timestamp and date.

Regards,
paul

-----Original Message-----
From: kfkong [mailto:kfkong@...]
Sent: Tuesday, 8 June 2004 9:40 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Re: Select statement with Date

--- In firebird-support@yahoogroups.com, "paul" <paulraj@s...> wrote:
>
> Hi,
>
> I have a some doubt about select statement using where clause
is
> date
> Say, I have table with login and logout Date fields,
>
> I need to select the persons whoever logout todays or any of
specified
> dates.
>
> I am using
>
> GregorianCalendar todayCal = new GregorianCalendar();
> java.sql.Date today = new java.sql.Date
(todayCal.getTimeInMillis());
>
> "Select EmpName, EmpID from EMP where logoutdate='"+today+"';
>
> I didn't get any values, what is the correct statement for above
> situation.
>
>
> Regards,
> N.Paul
>
>
>
> [Non-text portions of this message have been removed]


Paul,
Hi, my suggestion is you pass the today's date to a date variable
before setting it into the select statement. In the example above,
you are actually sending a text to a date column. As long as your
logoutdate is not a timestamp column then you will not need to use
CAST(logoutdate as DATE)...

Hope this will help you.

Peter





Yahoo! Groups Sponsor


ADVERTISEMENT

<http://rd.yahoo.com/SIG=129hvfcnk/M=298184.5022502.6152625.3001176/D=gr
oups/S=1705115386:HM/EXP=1086745214/A=2164330/R=0/SIG=11eamf8g4/*http:/w
ww.netflix.com/Default?mqso=60183350> click here


<http://us.adserver.yahoo.com/l?M=298184.5022502.6152625.3001176/D=group
s/S=:HM/A=2164330/rand=832997666>

_____

Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe
>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .


[Non-text portions of this message have been removed]