Re: timestamptz - problems

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: timestamptz - problems
Date: 2004-02-09 16:18:55
Message-ID: m3y8rcb500.fsf@wolfe.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Oops! RoberM1(at)gosh(dot)nhs(dot)uk ("Mark Roberts") was seen spray-painting on a wall:
> Hi im using 'timestamptz' in a function called: 'getdate' to enter
> the start and finish time into a db field, however the date appears
> to be inserted into the db in a random format, i wish for it to only
> be entered into the db as DD-MM-YYYY (European,UK). I understand
> this is probably a very simple problem to resolve but thus far I
> have failed, can anyone plz help.

It seems to me that you're asking the wrong question.

The data type you should normally use for handling timestamps is
"timestamptz," which records the date, time and time zone.

It is certainly _NOT_ inserted in a "random format;" there is NO
ambiguity about what the date and time types in PostgreSQL store in
the database.

What _might_ vary is how a date happens to be _displayed_, and that is
something that you might reasonably want to control.
--
wm(X,Y):-write(X),write('@'),write(Y). wm('aa454','freenet.carleton.ca').
http://www3.sympatico.ca/cbbrowne/x.html
This Bloody Century
"Early this century there was a worldwide socialist revolution. The
great battles were then between International Socialism, National
Socialism, and Democratic Socialism. Democratic Socialism won because
the inertia of democracy prevented the socialism from doing as much
damage here. Capitalism first reemerged from the ashes of National
Socialism, in Germany and Japan. It is now reemerging from the ashes
of International Socialism. Next?

After all, inertia works both ways..."
-- Mark Miller

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-02-09 16:38:42 Re: Index not used - now me
Previous Message Tom Lane 2004-02-09 16:09:34 Re: Implementation of a bag pattern using rules