on 10-31-2006 3:26 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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;
}
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.