Thread: DateTime fields

DateTime fields

From
"Dale Anderson"
Date:
I noticed that the DateTime fields and the to_timestamp function interpret 12 PM as 00:00 and 12 AM as 12:00.  Is
thisa bug???, or is there a configuration setting I need to enable to fix it???  I am running version 7.0.2 on RedHat
6.2

Thanks,
Dale.


Re: DateTime fields

From
"Dale Anderson"
Date:
I also noticed that 12 PM JUN 26 ends up as 00:00 JUN 27 ????  Whats up with adding one day also????

Dale.

>>> "Dale Anderson" <danderso@crystalsugar.com> 06/26/00 02:31PM >>>
    I noticed that the DateTime fields and the to_timestamp function interpret 12 PM as 00:00 and 12 AM as 12:00.  Is
thisa bug???, or is there a configuration setting I need to enable to fix it???  I am running version 7.0.2 on RedHat
6.2

Thanks,
Dale.



Re: DateTime fields

From
Joseph Shraibman
Date:
Just a guess, but it appears somebody forgot that 12pm comes after 11am,
and that 12am, comes after 11pm.

Dale Anderson wrote:
>
> I also noticed that 12 PM JUN 26 ends up as 00:00 JUN 27 ????  Whats up with adding one day also????
>
> Dale.
>
> >>> "Dale Anderson" <danderso@crystalsugar.com> 06/26/00 02:31PM >>>
>     I noticed that the DateTime fields and the to_timestamp function interpret 12 PM as 00:00 and 12 AM as 12:00.  Is
thisa bug???, or is there a configuration setting I need to enable to fix it???  I am running version 7.0.2 on RedHat
6.2
>
> Thanks,
> Dale.

Re: DateTime fields

From
Karel Zak
Date:
On Mon, 26 Jun 2000, Joseph Shraibman wrote:

> Just a guess, but it appears somebody forgot that 12pm comes after 11am,
> and that 12am, comes after 11pm.

Ops. Nice. Somebody not forget, but somebody didn't knows :-)

It is very difficult see the point that something sort numbers like
12pm, 01pm, 02pm.... :-)

A small question from ignorant European --- how qualify midnight via
PM/AM?

It will fixed in next version.

                    Karel


Re: DateTime fields

From
Joseph Shraibman
Date:
Karel Zak wrote:
>
> On Mon, 26 Jun 2000, Joseph Shraibman wrote:
>
> > Just a guess, but it appears somebody forgot that 12pm comes after 11am,
> > and that 12am, comes after 11pm.
>
> Ops. Nice. Somebody not forget, but somebody didn't knows :-)
>
> It is very difficult see the point that something sort numbers like
> 12pm, 01pm, 02pm.... :-)
>
> A small question from ignorant European --- how qualify midnight via
> PM/AM?
>
> It will fixed in next version.
>
Midnight is 12 am is 0:00.  Noon is 12 pm is 12:00.

>                                         Karel

Re: DateTime fields

From
Tom Lane
Date:
"Dale Anderson" <danderso@crystalsugar.com> writes:
>     I noticed that the DateTime fields and the to_timestamp function
> interpret 12 PM as 00:00 and 12 AM as 12:00.

Huh?

regression=# select '2000-06-12 12:00 am' ::datetime;
        ?column?
------------------------
 2000-06-12 00:00:00-04
(1 row)

regression=# select '2000-06-12 12:00 pm' ::datetime;
        ?column?
------------------------
 2000-06-12 12:00:00-04
(1 row)

Looks fine to me.
Could you be more precise about what you're trying to do?

            regards, tom lane

Re: DateTime fields

From
Thomas Lockhart
Date:
> > I noticed that the DateTime fields and
> > the to_timestamp function interpret
> > 12 PM as 00:00 and 12 AM as 12:00.
> Looks fine to me.

I'm seeing a bit of weirdness on my desktop Postgres-7.0.3 Mandrake
Linux installation, where am/pm results in a 60 second offset added to
the seconds field in the output (but also getting the 00:00/12:00 part
correct).

Same on my laptop, which has a 7.0.0 installation.

But my from-cvs installation of the current sources on the same laptop,
things look good.

I don't know why there would be a difference; afaik this code wasn't
touched recently.

                     - Thomas

Re: DateTime fields

From
Karel Zak
Date:
On Mon, 26 Jun 2000, Tom Lane wrote:

> "Dale Anderson" <danderso@crystalsugar.com> writes:
> >     I noticed that the DateTime fields and the to_timestamp function
> > interpret 12 PM as 00:00 and 12 AM as 12:00.
>
> Huh?
>
> Looks fine to me.

No, you overlook "to_timestamp()" in query. This routine really has bug in
PM/AM interpretation.

                    Karel


Re: DateTime fields

From
"Dale Anderson"
Date:
Here is am example of what I am doing.....

danderso=# \d test
           Table "test"
 Attribute |   Type    | Modifier
-----------+-----------+----------
 time      | timestamp |

danderso=# insert into test values (to_timestamp('1200 PM JUN 27 2000','HHMI PM MON DD YYYY'));
INSERT 22825 1
danderso=# select * from test;
          time
------------------------
 2000-06-28 00:00:00-05
(1 row)

danderso=#

Thanks,
Dale.

>>> Tom Lane <tgl@sss.pgh.pa.us> 06/26/00 05:41PM >>>
"Dale Anderson" <danderso@crystalsugar.com> writes:
>     I noticed that the DateTime fields and the to_timestamp function
> interpret 12 PM as 00:00 and 12 AM as 12:00.

Huh?

regression=# select '2000-06-12 12:00 am' ::datetime;
        ?column?
------------------------
 2000-06-12 00:00:00-04
(1 row)

regression=# select '2000-06-12 12:00 pm' ::datetime;
        ?column?
------------------------
 2000-06-12 12:00:00-04
(1 row)

Looks fine to me.
Could you be more precise about what you're trying to do?

            regards, tom lane


Re: DateTime fields

From
Karel Zak
Date:
 */

On Tue, 27 Jun 2000, Dale Anderson wrote:

> Here is am example of what I am doing.....
>
> danderso=# \d test
>            Table "test"
>  Attribute |   Type    | Modifier
> -----------+-----------+----------
>  time      | timestamp |
>
> danderso=# insert into test values (to_timestamp('1200 PM JUN 27 2000','HHMI PM MON DD YYYY'));
> INSERT 22825 1
> danderso=# select * from test;
>           time
> ------------------------
>  2000-06-28 00:00:00-05
> (1 row)
>

And for me:

test=# select to_timestamp('1200 PM JUN 27 2000', 'HHMI PM MON DD YYYY');
      to_timestamp
------------------------
 2000-06-27 12:00:00+02

but don't worry, you are right, I have NEW FIXED version. I commit it
tomorrow.

(Tom wanted show you that standard date/time routines are right only.)

                        Karel


Re: DateTime fields

From
Ted Nolan SRI Augusta GA
Date:
In message <Pine.LNX.3.96.1000627094243.5765A-100000@ara.zf.jcu.cz>you write:
>
>On Mon, 26 Jun 2000, Tom Lane wrote:
>
>> "Dale Anderson" <danderso@crystalsugar.com> writes:
>> >     I noticed that the DateTime fields and the to_timestamp function
>> > interpret 12 PM as 00:00 and 12 AM as 12:00.
>>
>> Huh?
>>
>> Looks fine to me.
>
>No, you overlook "to_timestamp()" in query. This routine really has bug in
>PM/AM interpretation.
>
>                    Karel
>

Just wanted to point out that there was a court case (involving "no
parking" signs with confusing hours) several years ago that established
that, for at least parts of the US, 12 Noon is legally neither AM nor
PM.  This actually makes logical sense as well,

    AM is "ante meridiem", ie "before noon"

and
    PM is "post meridiem", ie "after noon"

so noon itself can be neither.



                Ted Nolan