cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the format of an in build date

Former Member
0 Kudos

How to change the inbuild date datatype format?

Accepted Solutions (0)

Answers (1)

Answers (1)

SRudra
Contributor
0 Kudos

Hi

Follow the code below:

// Setting the Date in Indian format dd/mm/yyyy - in the wdInit() of the component controller

IWDAttributeInfo attribinfo = wdContext.getNodeInfo().getChild("Z_Bapi_XXXX").getChild("XXXX").getAttribute("XXXX");

ISimpleTypeModifiable simpleTypeModifiable = attribinfo.getModifiableSimpleType();

simpleTypeModifiable.setFormat("dd/MM/yyyy");

where XXX is the BAPI name and other XXX are the child attributes.

Cheers!!!

Sukanta Rudra

Message was edited by:

Armin Reichert

Former Member
0 Kudos

But I have the child attribute getting values from the supply function and it doesnt come under any bapi,then how should i go?

former_member751941
Active Contributor
0 Kudos

Hi Reinuka,

Check this threads.

Regards,

Mithu

Former Member
0 Kudos

hi

In that case > access the child attribute

IWDAttributeInfo attribinfo = wdContext.getNodeInfo().getChild("<node_name>").getNodeInfo().getChild("<inner_node>").getChild("XXXX").getAttribute("XXXX");

ISimpleTypeModifiable simpleTypeModifiable = attribinfo.getModifiableSimpleType();

simpleTypeModifiable.setFormat("dd/MM/yyyy");

Hopefully this gives u an answer

Thanks

Srikant

Former Member
0 Kudos

Hi Renuka,

Follow these steps:

1. Create a context attribute named date1

2. create a simple type (local Dictionary-->simpletype) named date1 of type date.

3. If you want your date format to be same always and doesn't require to change dynamically then go to representation tab for your simple type (date1) and set its format to dd/MM/yyyy(eg.)

4. For your context date1 set it type property to your simple type(using browse button ...)

5. Bind this context to a input field in your view

If you want to change the format of your date at runtime then you need to write this code in the method where you would like to change its format.

IWDAttributeInfo attr = wdContext.getNodeInfo().getAttribute("date1");

ISimpleTypeModifiable simple = attr.getModifiableSimpleType();

simple.setFormat("dd/MM/yyyy");

Regards,

Murtuza