cancel
Showing results for 
Search instead for 
Did you mean: 

Problem of Date Format

Former Member
0 Kudos

Hi Nibu,

Again I have faced a new problem.Could you please help me? To handle the date field in a CAF(Composite Application Framework) project we are calling one BAPI from an application service having date field in both

the input and output field. For that following steps are taken

1. BAPI - BAPI_FLIGHT_GETDETAIL is imported in the CAF DC project.

2. In the input parameter we have assigned the type of the field FLDATE as date object.

3. In the code of application service where we are calling the RFC there we are converting that date object to

YYYYMMDD string and passing that string to call the RFC. RFC call is succesfull.

4. But we are facing problem in time of displaying of the search result.

Because the date result we are getting that is a String(but it is date in r/3 system). In

display time it should be displayed as date object.

Now how to convert the string(format- Wed Aug 3 15:12:30.525 +0530 2005) to date(java.sql.Date)?

If you find any solve please send me details.

With Thanks & Regards

Sudip

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sudip,

use this snippet to solve your issue:


SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM d HH:mm:ss.S Z yyyy", Locale.US);
		
try {
   Date d = (Date) formatter.parse("Wed Aug 3 15:12:30.525 +0530 2005");
			
// convert to java.sql.Date
java.sql.Date sqlDate = new java.sql.Date(d.getTime());
			
} catch (ParseException e) {
   e.printStackTrace();
}