Hi Tom,

Thanks again, I did not appreciate the dual function of "AT TIME ZONE"  when
the input is timestamptz then the function converts from one timezone to
another (not what I wanted),

but when the input is timestamp the function acts more like a cast than a
convert (exactly what I wanted)

I must disagree with your assertion about the redundancy of:
>   , cast(start_datetime as timestamp(0) without time zone)::timestamp at
> time zone B.timezone_ch
 
what I am doing is taking a timestamptz, discarding its timezone, and then
casting it to another timezone

for example from  2006-10-03 09:00:00 NZST  to  2006-10-03 09:00:00 EST5EDT

If I am missing a much easier way to accomplish this please let me know.


Tom Lane-2 wrote:
> 
> chrisj <[EMAIL PROTECTED]> writes:
>> When I first saw your solution I thought it was logically going to do
>> (notice the parentheses):
>>     select ('2006-07-13 09:20:00'::timestamp) at time zone 'EST5EDT';  
>> which does not help
> 
> Well, actually, that's exactly what it does.  AT TIME ZONE is an
> operator that converts timestamp without time zone to timestamp with
> time zone (or vice versa).  I guess you could easily get confused
> here, but AT is not WITH.
> 
>>   , cast(start_datetime as timestamp(0) without time zone)::timestamp at
>> time zone B.timezone_ch
> 
> That's redundant --- you're casting the result of the cast to timestamp
> (implicitly without time zone), then applying the AT TIME ZONE operator.
> 
>                       regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Assigning-a-timestamp-without-timezone-to-a-timestamp-with-timezone-tf2373845.html#a6863766
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to