DateTime fields

Started by Dale Andersonalmost 26 years ago11 messagesgeneral
Jump to latest
#1Dale Anderson
danderso@crystalsugar.com

I noticed that the DateTime fields and the to_timestamp function interpret 12 PM as 00:00 and 12 AM as 12:00. Is this a 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.

#2Dale Anderson
danderso@crystalsugar.com
In reply to: Dale Anderson (#1)
Re: DateTime fields

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 this a 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.

#3Joseph Shraibman
jks@selectacast.net
In reply to: Dale Anderson (#2)
Re: DateTime fields

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

Dale Anderson wrote:

Show quoted text

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 this a 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.

#4Karel Zak
zakkr@zf.jcu.cz
In reply to: Joseph Shraibman (#3)
Re: DateTime fields

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

#5Joseph Shraibman
jks@selectacast.net
In reply to: Karel Zak (#4)
Re: DateTime fields

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.

Show quoted text

Karel

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dale Anderson (#1)
Re: DateTime fields

"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

#7Thomas Lockhart
lockhart@alumni.caltech.edu
In reply to: Dale Anderson (#1)
Re: DateTime fields

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

#8Karel Zak
zakkr@zf.jcu.cz
In reply to: Tom Lane (#6)
Re: DateTime fields

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

#9Dale Anderson
danderso@crystalsugar.com
In reply to: Karel Zak (#8)
Re: DateTime fields

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

#10Karel Zak
zakkr@zf.jcu.cz
In reply to: Dale Anderson (#9)
Re: DateTime fields

*/

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

#11Ted Nolan SRI Augusta GA
ted@ags.ga.erg.sri.com
In reply to: Karel Zak (#8)
Re: DateTime fields

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