You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Keshava Murthy <ke...@bigtec.org> on 2002/11/12 12:19:53 UTC
Re: Date comparison
Hi,
I would like to convert string obtained from vm file (format = dd/mm/yyyy
and dd/mm/yyyy hh24:mi) to java.sql date and compare this against a field
in oracle database.
Could some one tell me how this can be done?
regards,
Keshava Murthy
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Date comparison
Posted by Keshava Murthy <ke...@bigtec.org>.
Hi Nataraj,
Thanks for your response.
I solved this by using the method - Date.valueOf(String str). Do you think
the method you defined will be more useful if I require to save time along
with Date.
regards,
keshav
----- Original Message -----
From: "K Nataraj" <kn...@prodapt.com>
To: "'Turbine Users List'" <tu...@jakarta.apache.org>
Sent: Wednesday, November 13, 2002 6:06 PM
Subject: RE: Date comparison
> U can get the the date from VM like this..
>
> String date = parser.get("dateField");
>
> this u can convert to java.sql.Date using the
> SimeplDateFormatter class of java.text package .,
>
>
> a sample goes like this
>
> SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // This
> yyyy-MM-dd is configurable..Refer jdk // //documentation for futher
> details..
> ParsePosition position = new ParsePosition(0);
> java.sql.Date date = (java.sql.Date)
dateFormat.parse(dateString,position);
> return date;
>
>
> Now u can compare the values as u wish..Hope this helps...
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Date comparison
Posted by Keshava Murthy <ke...@bigtec.org>.
Hi,
I tried to use the method you sugested, but the line
"java.sql.Date date = (java.sql.Date)
dateFormat.parse(dateString,position);"
is throwing java.lang.ClassCastException: java.util.Date.
Can you tell me how to get sql Date object ?
regards,
Keshava Murthy. S
----- Original Message -----
From: "K Nataraj" <kn...@prodapt.com>
To: "'Turbine Users List'" <tu...@jakarta.apache.org>
Sent: Wednesday, November 13, 2002 6:06 PM
Subject: RE: Date comparison
> U can get the the date from VM like this..
>
> String date = parser.get("dateField");
>
> this u can convert to java.sql.Date using the
> SimeplDateFormatter class of java.text package .,
>
>
> a sample goes like this
>
> SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // This
> yyyy-MM-dd is configurable..Refer jdk // //documentation for futher
> details..
> ParsePosition position = new ParsePosition(0);
> java.sql.Date date = (java.sql.Date)
dateFormat.parse(dateString,position);
> return date;
>
>
> Now u can compare the values as u wish..Hope this helps...
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Date comparison
Posted by K Nataraj <kn...@prodapt.com>.
U can get the the date from VM like this..
String date = parser.get("dateField");
this u can convert to java.sql.Date using the
SimeplDateFormatter class of java.text package .,
a sample goes like this
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); // This
yyyy-MM-dd is configurable..Refer jdk // //documentation for futher
details..
ParsePosition position = new ParsePosition(0);
java.sql.Date date = (java.sql.Date) dateFormat.parse(dateString,position);
return date;
Now u can compare the values as u wish..Hope this helps...
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>