Hi there!


I'm experiencing quite a strange behaviour when retrieving dates from a
mysql table.
I'm doing the following in Java:

  StringBuffer sql = new StringBuffer( "SELECT datum FROM runde WHERE
runde_id = 146" );
  Statement stmt = conn.createStatement();
  ResultSet rs = stmt.executeQuery(sql.toString());
  if( rs.next() )
  {
        Date date = rs.getDate("maxDate");
        System.out.println( "DATE=" + date );
  }

As a result I get: DATE=2000-10-09

But this is wrong!! The correct date should be 2000-10-08, so it's one day
off.
This seems to be the case for all dates I tried. Every date is off by
exactly one day.

When I run the same query in MySqlManager I get the correct result:
2000-10-08.

Has anyone seen this rather strange behaviour and knows how to avoid this?

I also tried to retrieve the date as a java.sql.Timestamp which resulted in
2000-10-09 04:00:00

This is not exactly midnight but normally this shouldn't move the date
forward by one, should it?

I'm using the Win32 V3.23  release.

Regards,

Dirk Illenberger.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to