cancel
Showing results for 
Search instead for 
Did you mean: 

Date representation problem

Former Member
0 Kudos

Hi,

I am trying to modify the on screen representation of my date field . The date is being shown as 10/03/2010 but I want it to be shown as Oct/03/2010 . The main idea is that the month should be in words.

I created a simple type of type date and in the representation of this simple type , I gave format as MMM/dd/yyyy. However I am still getting the date as 10/03/2010. All my bindings are correct.

Is there something wrong with my solution or is there any other way out.

TIA.

Himanshu

Accepted Solutions (0)

Answers (4)

Answers (4)

srinivas_sistu
Active Contributor
0 Kudos

Hi,

If you are using date picker in ur webdynpro, then it will display date as per the language property of the logged in user. This generally will be DD-MM-YYYY or MM-DD-YYYY format.

if you are very specific about DD-MMM-YYYY, then u can probably go with SimpleDateFormat and create ur custom dropdowns.

Regards,

SrinivaS

nikhil_bose
Active Contributor
0 Kudos

If the date picker is not needed, change the attribute type of 'my date field' to String. And use the below code to set the format and the date value.


DateFormat dateFormat = new SimpleDateFormat("MMM/dd/yyyy");
String myDate = dateFormat.format( originalDate);

Regards,

Nikhil Bose

Former Member
0 Kudos

Hi,

Probably you can customize it for your use. Create a separate method and define the digits from 0-12 to Jan to Dec like 01=Jan, 02=Feb and rearrange your date as to the required format.

This may take some time but you can customize it always as per your requirement. Hope this helps!

Thanks!

Gaurav

Former Member
0 Kudos

Hi,

Please try with the SimpleDateFormat to format the given date.

DateFormat dateFormat = new SimpleDateFormat("MMM/dd/yyyy");

String formatteddate = dateFormat.format(<date attrib>);

You will get the desired output. Do revert for any clarifications.

Regards,

Saravanan K

Edited by: Saravanan K on Oct 5, 2010 6:42 AM

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Himanshu,

I am not sure this is possible in a generic way. The date format is specified by the given local.

See the note #947081 -- Locales, languages, date and time formats in Web Dynpro

(http://service.sap.com/sap/support/notes/947081)

You can retrieve the date as specified by your local and then implement your custom solution to display the month by a word.

Best Regards,

Ervin