Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dateformat Error

Hi Friends,

In Portal calender side that Date format show like (mm/dd/yyyy) like that i need display the date format in portal calender(dd/mm/yyyy) like this. So i have to done some code here

Ymm_Sc_Bapieindt delvDateRange = new Ymm_Sc_Bapieindt();

wdContext.nodeDaterange().bind(delvDateRange);

SimpleDateFormat sdfDate = new SimpleDateFormat("DD/MM/YYYY");

String datestr = sdfDate.format(new java.util.Date());

delvDateRange.setFrom_Date(datestr);

delvDateRange.setTo_Date(datestr);

input.addDaterange(delvDateRange);

i am getting Error here.

delvDateRange.setFrom_Date(datestr);

delvDateRange.setTo_Date(datestr);

That error is This method setFrom_Date/setTo_Date(Date) in the type Ymm_Sc_Bapieindt is not applicable for the arguments (String)

I m getting this error

How to slove this

Regards

Vijay

Former Member replied

Hi Vijay,

You can just parse the date into which ever format you like.

Date startDate = null;
String strStartDate = null;

strStartDate = wdContext.currentNode_Element().getValueAttriute();

DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
try {
	startDate = df.parse(strStartDate);
}	       
catch (ParseException e) {
wdComponentAPI.getMessageManager().reportException("Error in Formatting the Date",false);
}

Hope this helps you.

Regards,

p188071.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question