cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use java.util.Date and change display format.

Former Member
0 Kudos

Hello All,

I want to use java.util.Date in View Context and in Custom Control Context of Web dynpro java. When i mapped of a Input Field to the java.util.Date then message shows that its not supported. Plz suggest me how to handle Date with different formats ??

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

If you always want the user to enter the date in dd/MM/yyyy, you can do the following.

Goto Local Dictonary -> Simple types in your project and create a type known as "InputDate" (or whatever you feel) of built-in type 'Date'.

Now specifiy its format in the 'Representation' tab as "dd/MM/yyyy" (case-senstive).

Now declare a value attribute say "inputdate" in your context with this type and bind the inputfield to this context value attribute.

This will solve your problem.

But if you want the user to input date depending on the region he belongs, change the default locale date in Control Panel->Regional and Language Options->Change to English(UK) -> Customize -> Date Tab -> Sort Date Format to dd/MM/yyyy.

Now clear the cache, delete temporary files and restart the machine. This should solve the problem.

Former Member
0 Kudos

Hi ,

For using date format in WebDynpro,you need to take attribute as date not util.date.(type of the input field as date)

After that in coding fr storing teh values in db you need to use the dtae formatter and parse the string and send ,the formatter will be of java.util.Date).

Just try once and lemme kno i can provide you code snippet or else you can get on sdn itself.

Regards,

Anu

Former Member
0 Kudos

Hi ,

For using date format in WebDynpro,you need to take attribute as date not util.date.(type of the input field as date)

After that in coding fr storing teh values in db you need to use the dtae formatter and parse the string and send ,the formatter will be of java.util.Date).

Just try once and lemme kno i can provide you code snippet or else you can get on sdn itself.

Regards,

Anu

Former Member
0 Kudos

HI Anu,

So, in this case you mean to take the input as a string and do a Simple date formatting to util.date ?

Regards,

p188071.

Former Member
0 Kudos

HI Anu,

So, in this case you mean to take the input as a string and do a Simple date formatting to util.date ?

Regards,

p188071.

susmita_panigrahi
Active Participant
0 Kudos

Hi

Create a simple data type "DateFormat" in Local Dictionary section of Webdynpro explorer and map the Type property of context attribute to this simple data type.Open the Simple Data type and in the Representation tab of Simple data type you can mention any format(dd.MM.yyyy) and in the Definition tab select the "built in type" as date.

So when you use the context attribute in the code , it will ask you to import the Date package.Select import java.util.Date.

Thanks

Susmita