Re: timezone help?

From: tomas(at)tuxteam(dot)de
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, David Salisbury <salisbury(at)globe(dot)gov>
Subject: Re: timezone help?
Date: 2011-07-19 20:05:03
Message-ID: 20110719200503.GA20374@tomas
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, Jul 19, 2011 at 12:15:54PM -0700, Adrian Klaver wrote:
> On Tuesday, July 19, 2011 12:01:19 pm David Salisbury wrote:
> > I'm a bit new to PG, and having troubles with timestamps. The docs list:

[...]

> > My immediate problem is below..
> >
> > create or replace function get_thermom_type(siteid integer, observationtime
> > timestamp)

[...]

> How about:
> test(5432)aklaver=>SELECT to_timestamp('01-JAN-2011','DD-MON-YYYY')::timestamp;
> to_timestamp
> ---------------------
> 2011-01-01 00:00:00

Simply TIMESTAMP '01-JAN-2011' should work too:

| test=# create or replace function fu(t timestamp) returns timestamp as
| $$
| begin
| return $1;
| end $$ language plpgsql;
| CREATE FUNCTION
| test=# select fu(TIMESTAMP '01-JAN-2011');
| fu
| ---------------------
| 2011-01-01 00:00:00
| (1 row)

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFOJeNvBcgs9XrR2kYRAm9yAJ9EgZ3IN9Y1WrsQ9ke4rNXVGLEF6gCeI8/L
Ii66It4LvdL/6reVNti9ZBo=
=8fUi
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Antonio Vieiro 2011-07-19 21:32:46 Re: Detecting memory leaks with libpq?
Previous Message Steve Crawford 2011-07-19 20:03:40 Re: timezone help?