pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ken Kachnowich <khkachn@toad.net>
To: Postgres interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: datetime fix
Date: Mon, 16 Oct 2000 19:37:04 -0400
Message-ID: <39EB9120.F4D480D8@toad.net> (raw)
References: <Pine.LNX.4.10.10010130935000.29625-100000@tirin.openworld.co.uk>

Thanks Michael.

A couple of typos in what you sent. The uppercase MM for the minuets
should be lowercase mm.

Unfortenitly this does not work for me. When I select from the database
with psql I see times like this:

11:30:10.74-04  or
11:30:10-04

I do not know where the -04 is coming from or what it means.
What I want to do is select a timestamp field from one table and 
use it in a select from another table. The times in the two tables
are exactly the same. But even with the fix the second select fails
to get the record.

Ken


Michael Stephenson wrote:
> 
> > Was there a rummer that a patch was coming out that fixed a bug with
> > the datetime field? I'm getting times with dashes in the milliseconds
> > (i.e.:  12:01:00.10-04 or something like that).
> 
> I placed a patch on the mailing list a few days ago, which fixes the
> problem, hope this helps.
> 
> Michael Stephenson
> 
> *** src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java     Fri May 12
> 20:54:22 2000
> --- src/interfaces/jdbc/org/postgresql/jdbc2/ResultSetPatch.java
> Mon Sep 25 15:36:46 2000
> ***************
> *** 439,445 ****
>       if(s==null)
>         return null;
> 
> !     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd
> HH:mm:sszzz");
> 
>       try {
>         return new Timestamp(df.parse(s).getTime());
> --- 439,456 ----
>       if(s==null)
>         return null;
> 
> !     SimpleDateFormat df = null;
> !     if (s.length()>21 && s.indexOf('.') != -1) {
> !         df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
> !     } else if (s.length()>19 && s.indexOf('.') == -1) {
> !         df = new SimpleDateFormat("yyyy-MM-dd HH:MM:sszzz");
> !     } else if (s.length()>19 && s.indexOf('.') != -1) {
> !         df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss.SS");
> !     } else if (s.length()>10 && s.length()<=18) {
> !         df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
> !     } else {
> !         df = new SimpleDateFormat("yyyy-MM-dd");
> !     }
> 
>       try {
>         return new Timestamp(df.parse(s).getTime());



view thread (11+ messages)  latest in thread

Message-ID: <39EB9120.F4D480D8@toad.net>
Permalink:  ../39EB9120.F4D480D8@toad.net/
Also on:    postgresql.org/message-id/39EB9120.F4D480D8@toad.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: khkachn@toad.net
  Subject: Re: datetime fix
  In-Reply-To: <39EB9120.F4D480D8@toad.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox