on 10-04-2010 10:54 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.