Java Calendar to String returns wrong date -
i have calendar instance returned webservice stub following date: 0001-12-31
but when use gettime() method becomes: 0002-01-02
first thought caused formatter returned date instance wrong.
can explain why?
if (cal != null) { system.out.println(cal.tostring()); dateformat sqlformat = new simpledateformat("yyyymmdd"); sqlformat.settimezone(cal.gettimezone()); string formatted = sqlformat.format(cal.gettime()); system.out.println(formatted); return formatted; }
Comments
Post a Comment