Re: timezone help?

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

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:
>
> timestamp [ (p) ] [ without time zone ] 8 bytes both date and time 4713
> BC 5874897 AD 1 microsecond / 14 digits timestamp [ (p) ] with time zone
8
> bytes both date and time, with time zone 4713 BC 5874897 AD 1 microsecond
> / 14 digits
>
> But an example of how to call to_timestamp either with or without a TZ
> would help.
>
>
>
> My immediate problem is below..
>
> create or replace function get_thermom_type(siteid integer, observationtime
> timestamp)
>
> select get_thermom_type(1,to_timestamp('01-JAN-2011','DD-MON-YYYY') );
> ERROR: function get_thermom_type(integer, timestamp with time zone) does
> not exist LINE 1: select
> get_thermom_type(1,to_timestamp('01-JAN-2011','DD-MON... ^
> HINT: No function matches the given name and argument types. You might
> need to add explicit type casts.
>
>
> How do I tell to_timestamp to forget the about time zones? this didn't
> work either:
>
> get_thermom_type(1,to_timestamp('01-JAN-2011 HH24:MI','DD-MON-YYYY 13:01')
> without time zone); nor a bunch of other attempts.

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

>
>
> Thanks for any help,
>
> -Dave

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gurjeet Singh 2011-07-19 19:17:19 A few user-level questions on Streaming Replication and pg_upgrade
Previous Message David Salisbury 2011-07-19 19:01:19 timezone help?