ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giovanni Cuccu <giovanni.cu...@cup2000.it>
Subject Re: How to use system date
Date Wed, 27 Jun 2007 09:47:47 GMT
I guess you are using oracle. If so you have to check the following 
condition:
what kind of date is storend on the db ("select to_char(date,'dd/mm/yyyy 
hh24:mi') from test"). My guess is that you have also hour and minutes 
stored on the db.
If you have hour and minutes on the db you can do the following
select * from test where date between trunc(sysdate) and trunc(sysdate)+1
Hope it helps,
	Giovanni


> Can I use to_date(sysdate, 'dd-mm-yyyy') to remove the precision for
> time of the day? Cos I have a value in db "27-JUN-2007'. But when I pass
> to_date(sysdate, 'dd-mm-yyyy') to my select query in iBatis, it does not
> return any value.
> Any help in this will be great.
> Thanks
> 
> -----Original Message-----
> From: Ralf Assmann [mailto:ralf.assmann@innovations.de] 
> Sent: Wednesday, June 27, 2007 2:07 PM
> To: Mani, Bharathi
> Subject: Re: How to use system date
> 
> 
> Depending on your database, you can use the database' date, e.g. for a
> db2:
> 
> "select * from test where date = current date"
> 
> The should be similar functions for other databases. Alternatively, make
> 
> a java.sql.Date using System.currentTimeMillis() and pass this
> attribute.
> 
> 
> Ralf Assmann
> 
> -------------------------------------------------------------------
> Ralf Assmann, Dipl.-Ing. (FH)
> Innovations Softwaretechnologie GmbH
> Ziegelei 7, 88090 Immenstaad, Germany
> Tel.: +49 7545 202-324
> Tel.: +49 7545 202-300 (Zentrale)
> Fax.: +49 7545 202-301
> Email: ralf.assmann@innovations.de
> Web: http://www.innovations.de
> -------------------------------------------------------------------
> Geschaeftsfuehrung: 
> Achim Berger, Thomas Cotic, Walter Pitz
> Reg.-Gericht Ulm HRB 631622
> -------------------------------------------------------------------
> 
> 
> 
> 
> bharathi.mani@accenture.com schrieb:
>> Hi,
>>
>> How can I pass current system date to a select query in iBatis?
>>
>> 'Select * from test where data = sysdate'. Will this work?
>>
>> Thanks,
>>
>> Bharathi
>>
>> This message is for the designated recipient only and may contain 
>> privileged, proprietary, or otherwise private information. If you have
> 
>> received it in error, please notify the sender immediately and delete 
>> the original. Any other use of the email by you is prohibited.
>>
> 
> 
> This message is for the designated recipient only and may contain privileged, proprietary,
or otherwise private information.  If you have received it in error, please notify the sender
immediately and delete the original.  Any other use of the email by you is prohibited.
> 
> 


-- 
Giovanni Cuccu
CUP 2000 Spa
Via del Borgo di S. Pietro, 90/c - 40126 Bologna
e-mail: giovanni.cuccu _at_ cup2000.it


Mime
View raw message