cancel
Showing results for 
Search instead for 
Did you mean: 

Date Format

Former Member
0 Kudos

Hi,

I have a table with one column as Date from and Date to

i set dates in these columns using the calender.

these two columns are import parameters of an rfc.

Now i need to send the data to my RFC import parameter in this format that is dd.MM.yyyy

but webdynpro automatically processs the input date given to

yyyy.mm.dd

and Rfc raises an error ie it needs date in dd.MM.yyyy

pls help me out how do i do it.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try this,

Date date;

DateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");

string dateString=formatter .format(<date from >);

date = (Date)formatter.parse(dateString);

pass the date to table date from,like do for date to also.

hope it helps you.

Regards,

ramesh

Former Member
0 Kudos

I would suggest you add test cases to test with different locale-s. I am not sure the RFC requires the date format always in dd.MM.yyyy. It again depends on similar server settings. To give a generic solution, you must dig in further or draw a scope on what to assume on the server locations and user profiles.

Easwar Ram

http://www.parxlns.com

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Have a workaround on the following code, it will be the answer for your question. Here I used System Date and converted to required format like Monthname-Date-Year. You change the format and workaround (like dd,mm,yyyy). My NWDS is not working so I can not try here

try

{

long l = System.currentTimeMillis();

java.sql.Date dt = new java.sql.Date(l);

wdComponentAPI.getMessageManager().reportSuccess("Date: " + dt);

SimpleDateFormat g_objDateFormat = new SimpleDateFormat("MMMM dd, yyyy");

wdContext.currentContextElement().setAbc(g_objDateFormat.format(dt));

}

catch (NullPointerException e)

{

wdComponentAPI.getMessageManager().reportException(e.toString(), true);

}

Regards

Raghu

former_member192434
Active Contributor
0 Kudos

Hi

Use this sample code link to format the date

http://javatechniques.com/blog/dateformat-and-simpledateformat-examples/

thanks

Former Member
0 Kudos

Hi,

Create a simple type data type of date and in the format section specify the format that you need as DD/MM/YYYY and bind the context node with this dictionary type

Try this it will help you

Thanks & Regards

Padma N