cancel
Showing results for 
Search instead for 
Did you mean: 

Date Picker - java.sql.Date

Former Member
0 Kudos

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());

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

indeed. the date is displayed correctly now.

thank you.

Regards

Michael

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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