cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with date in the JCO. (day 08 that it turns 07)

Former Member
0 Kudos

The problem that persists is that when informing to day "20061008" (YYYYMMDD) component "JCO" deducts date 1 less, thus inserting the day of "20061007" (YYYYMMDD). This problem happens only for day "20061008" (YYYYMMDD) in the too much days of any month and year functions normally.

What I can make? In view of that already I brought up to date component JCO.

<b>>>>Code Sample:</b>

<%@ page import="com.sap.mw.jco.JCO"%>

<%

JCO.MetaData meta= new JCO.MetaData("teste");

meta.addInfo("DATA",JCO.TYPE_DATE,8);

JCO.Table tab = new JCO.Table(meta);

tab.appendRow();

tab.setValue("20061008","DATA");

out.println(tab.getDate("DATA").toString());

%>

<b>>>>Result:</b>

Sat Oct 07 00:00:00 BRT 2006

Somebody already passed for this problem?

Thank's and Regards.

Nadim.

Message was edited by: Nadim Junior

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Nadim,

even i had same problem some days back but even i don't get any logical answer to this problem but some one had told me to check the version of classes12.jar on the server and update it if it was older than <b>10.2.0.1</b> version and it worked for me

I don't know what was the problem but at last it was solved for me even you can try it.

And if you can solve this problem just let me know what was the exact problem

Thanks

Ninad

Former Member
0 Kudos

Hi Ninad,

How I make to catch the version of the class "classes12.jar"?

Thank's and Regards.

Nadim.

Former Member
0 Kudos

Apart from the classes12.jar this looks to me like a simple Timezone problem. I don't know which timezone the server runs in and which timezone you run in (Brazil?) but if the parsing happens in GMT and the formatting in Brazilian TZ it would still be the previous day there... @00:00:01 GMT

So you may have to be specific as to what time zone you are looking at, or make sure that the JCO user is in the right timezone by default.

Enjoy

Former Member
0 Kudos

Hi Nadim

Open the file with winzip or similar software and in that you can find the file <b>Manifest.mf</b> version and all information related to that jar is stored check it

Ninad

roberto_tagliento
Active Contributor
0 Kudos

I had something similir like that, my solution was:

private java.sql.Date ConvertToDate(java.sql.Date inD){

Calendar cal = Calendar.getInstance();

String test = new String("");

cal.setTime(inD);

test = test.concat(new Integer(cal.get(Calendar.HOUR_OF_DAY)).toString()).concat(" *** ");

if (cal.get(Calendar.HOUR_OF_DAY) > 0)

cal.set( Calendar.DATE, cal.get(Calendar.DATE) + 1 );

cal.set( Calendar.HOUR_OF_DAY, 0 );

cal.set( Calendar.MINUTE, 0 );

cal.set( Calendar.SECOND, 0 );

cal.set( Calendar.MILLISECOND, 0 );

java.sql.Date jsqlD =

new java.sql.Date( cal.getTime().getTime() );

test = test.concat(new Integer(cal.get(Calendar.HOUR_OF_DAY)).toString()).concat(" *** ");

test = test.concat(inD.toString().concat(" -- ").concat(jsqlD.toString()));

//test is a DEBUG variable

return jsqlD;

}