jdbc timestamp-parsing

Поиск
Список
Период
Сортировка
От Thomas Rohwer
Тема jdbc timestamp-parsing
Дата
Msg-id 369016B6.E9B16861@uiuc.edu
обсуждение исходный текст
Список pgsql-interfaces
There is a little typo in the code for getTimestamp
in the file jdbc1/ResultSet.java and jdbc2/ResultSet.java

  public Timestamp getTimestamp(int columnIndex) throws SQLException
  {
    String s = getString(columnIndex);
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd
HH:mm:sszzz");

    if (s != null)
      {
    int TZ = new Float(s.substring(19)).intValue();
    TZ = TZ * 60 * 60 * 1000;
    TimeZone zone = TimeZone.getDefault();
    zone.setRawOffset(TZ);
    String nm = zone.getID();
-->    s = s.substring(0,18) + nm; // should probably be s.substring(0,19)+
nm

which leads to an incorrect interpretation of timestamps:

timestamp:1999-01-03 18:35:47+01
date:1999-01-03 18:35:04.0

.


Thomas Rohwer

В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Michael Philipp
Дата:
Сообщение: subscribe
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [INTERFACES] Problems building libpgtcl