L
lambelly
I'm having a rather annoying date inconsistency error.
This code:
System.setProperty("user.timezone", "GMT");
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy/MM/dd
HH:mm:ss");
java.util.Date day = new java.util.Date();
Calendar calendar = new
GregorianCalendar(TimeZone.getTimeZone("GMT"));
calendar.setTime(day);
coupled with this query:
Sql = "UPDATE RPA SET " +
"VERIFICATION_ID = " + n_VeriStatus +
", NAME = 'Refer to Contract', " +
"ACCOUNT = '00000000000', " +
"SITE = '000', " +
"ACCEPTANCE_TYPE = 'IVR', " +
"ACTION_TIME = to_date('" +
formatter.format(calendar.getTime()) + "', 'yyyy/mm/dd hh24:mi:ss') " +
is sometimes placing an inconsistent value in the database. What I mean
by that is, usually it seems to convert to GMT time normally. Other
times the time is off on the date are by a few hours. There doesn't
appear to be any pattern to when it is off. My initial assumptions are
that this has to do with this code maybe running on different machines
perhaps on different versions of the JDK. Can anyone else think of
reasons this code might not convert to GMT properly or fixes to this
code?
This code:
System.setProperty("user.timezone", "GMT");
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy/MM/dd
HH:mm:ss");
java.util.Date day = new java.util.Date();
Calendar calendar = new
GregorianCalendar(TimeZone.getTimeZone("GMT"));
calendar.setTime(day);
coupled with this query:
Sql = "UPDATE RPA SET " +
"VERIFICATION_ID = " + n_VeriStatus +
", NAME = 'Refer to Contract', " +
"ACCOUNT = '00000000000', " +
"SITE = '000', " +
"ACCEPTANCE_TYPE = 'IVR', " +
"ACTION_TIME = to_date('" +
formatter.format(calendar.getTime()) + "', 'yyyy/mm/dd hh24:mi:ss') " +
is sometimes placing an inconsistent value in the database. What I mean
by that is, usually it seems to convert to GMT time normally. Other
times the time is off on the date are by a few hours. There doesn't
appear to be any pattern to when it is off. My initial assumptions are
that this has to do with this code maybe running on different machines
perhaps on different versions of the JDK. Can anyone else think of
reasons this code might not convert to GMT properly or fixes to this
code?