Skip to Content
author's profile photo Former Member
Former Member

Date Picker - java.sql.Date

to make use of the Date Picker UI-Element I declared my Context-Field of type Date which is mapped to java.sql.Date. (Why?)

Now I want to show today's Date as default value.

The following code gives me e.g dd.MM.yy as value in my InputField. I want the format dd.MM.yyyy which is what DatePicker gives back.

How can I achieve that?

Regards

Michael

java.util.Calendar cal = new GregorianCalendar();

java.sql.Date bookingDate = new java.sql.Date(cal.getTime().getTime());

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 26, 2004 at 04:48 PM

    Hi Michael,

    i tried this also, using a context attribute of builtin type "date" and an input field, but for me it works with the code or also with:

    wdContext.currentContextElement.setDatum(new Date(System.currentTimeMillis()));

    I get 26.03.2004, not 26.03.04. Which WebAS version are you using?

    Regards

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 29, 2004 at 06:23 AM

    Thank you Stefan. So I guess that the Version is the problem. Your code produced the same result as mine before. I am still using the 2.0.2 version of the NDS with AppServer 6.30. You are using Sneak II I guess?

    Regards

    Michael

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Michael,

      not really Sneak II, it's a 6.40 beta version. Anyway, your problem should have been solved in the productive release.

      In the meantime you could try to create and use a simple type based on the builtin date type and a format pattern assigned (maybe dd.MM.yyyy) to it. I guess, the format should be used by the CSF for display.

      Regards

      Stefan

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2004 at 07:18 AM

    indeed. the date is displayed correctly now.

    thank you.

    Regards

    Michael

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.