Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 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

  • avatar image
    Former Member
    Mar 30, 2004 at 07:18 AM

    indeed. the date is displayed correctly now.

    thank you.

    Regards

    Michael

    Add comment
    10|10000 characters needed characters exceeded