on 11-28-2007 1:23 PM
Hi,
I am creating a webdynpro application, with a DatePicker and 2 Input Fields called Start_Date and End_Date.
When i write the code it says "Cannot Convert from String to Date".
/*
Date Start = wdContext.currentDatepickElement().getStart();
SimpleDateFormat df = new SimpleDateFormat("DD/MM/YYYY");
Date End = wdContext.currentDatepickElement().getEnd();
SimpleDateFormat df = new SimpleDateFormat("DD/MM/YYYY");
*/
How can i get the Date which i selected into the two input fields?
Regards,
Divya
I changed the code to
String Start;
Date date;
SimpleDateFormat df = new SimpleDateFormat("DD/MM/YYYY");
date = (Date).df.parse(Start);
Start = wdContext.currentDatepickElement().getStart();
Endt = wdContext.currentDatepickElement().getEnd();
Giving me an error "Date cannot be resolved". The error is at line 5. How can i resolve this?
Regards,
Divya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this
try{
String start= wdContext.currentDatepickElement().getStart();;
Date dtTmp = new SimpleDateFormat("MMM d, yyyy H:mm").parse(start);
String strOutDt = new SimpleDateFormat("MM/dd/yyyy").format(dtTmp);
System.out.println("String to date conversion:" + strOutDt);
}catch(Exception e){
}
reward points if helpful
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.