cancel
Showing results for 
Search instead for 
Did you mean: 

Date dispaly format

Former Member
0 Kudos

Hi,

I have UI element, for which value is directly mapped to the model attribute.(which is a date field)

Bapi is sending the date in the format of -- YYYYMMDD.

In the portal it is displayed as --- MM/DD/YYYY.

As per the requirement it has to be displayed as DD/MM/YYYY.

I think it is picking automatically by the systemdate format (not sure).

How can i display in DD/MM/YYYY format, even though bapi send us in YYYY/MM/DD format

Thanks

Maha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Maha,

You can use the following code for setting the date format and the time zone as per your requirement:

//formatting the Date
TimeZone tz = TimeZone.getTimeZone("GMT+05:30");
SimpleDateFormat formatter =(SimpleDateFormat)DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, Locale.US);
formatter.setTimeZone(tz);
formatter.applyPattern("DD/MM/YYYY");

take your UI element name and set Formatter.format(Your UI).

Hope it helps.

Regards,

Gaurav.

Answers (3)

Answers (3)

lokesh_kamana
Active Contributor
0 Kudos

Hi,

Please check the folllowing code

			
SimpleDateFormat fSDateFormat = new SimpleDateFormat ("dd/MM/yyyy");
Date now = new Date ();
wdcomponentAPI.getMessageMananger.reportSuccess(now.toString());
String date_out = fSDateFormat.format (now);
wdcomponentAPI.getMessageMananger.reportSuccess(date_out.toString());

Here i inserted the system date.

There you take of the date and keep the date which you are getting from BAPI.

Thanks & Regards,

Lokesh

Former Member
0 Kudos

Hi,

Create a simple Type in Dictionary.In that in the representation tab metion the format which you want to display like yyyy/MM/dd etc.

Then map the type of the context attribute to this dictionary simple type.Then you will get the format you want

Regards

padma N

Former Member
0 Kudos

Hi,

Please refer this thread you may get some idea,

Regards,

ramesh