On Fri, 2003-01-31 at 17:59, Scherler, Thorsten wrote:
> Yes, I am doing that right now.
> 
> But the people using the app that I am writing don't want type 01/30/2003 to get the 
>reports.
> The main reason is that the company that I am working for is in Germany. So the user 
>wants to put 30.01.2003 in the form.
> 
> If I parse that into the esql I can't get any data out of db.
> 
> I thought about client-side JavaScript to transform the date and then parse it, but 
>I hoped that I could transform it on the server side with xsp.
> 
> You said something about: simply invert the process on the SimpleDateFormat object. 
> 
> How would I do that?
I think what you are trying to do is the following:
Date myDate = (new
SimpleDateFormat("dd.MM.yyyy").parse(request.getParameter("date"));
String dateParam = (new SimpleDateFormat("MM/dd/yyyy")).format(myDate);
That will receive the date in format 30.01.2003 and convert it to
01/30/2003

I'm not sure if you've understood the <esql:parameter> concept fully.
Using the esql parameter will result in java code that looks something
like the following:

...
PreparedStatement statement = conn.prepareStatement("select * from table
where datecolumn = ?");
statement.setDate(1, myDate);
...

When using code like this, you don't have to worry about the format the
database engine uses, you only have to worry about the format the user
uses and parse that into a Date object.

I do realise that I may not always understand exactly what you are
asking so please keep asking until we fully understand each other.

-- 
Andrew Timberlake <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to