From: Tom Lane <tgl@sss.pgh.pa.us>
To: James G Wilkinson <jgw@alpinegeophysics.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Date/Time Conversion
Date: Sat, 02 Apr 2005 22:50:36 -0500
Message-ID: <8222.1112500236@sss.pgh.pa.us> (raw)
In-Reply-To: <4249ED1F.6080909@alpinegeophysics.com>
References: <4249ED1F.6080909@alpinegeophysics.com>
James G Wilkinson <jgw@alpinegeophysics.com> writes:
> beta_jgw=# update scenario1.time_test set local_day = extract(day from
> to_timestamp(to_char(gmt_date,'YYYY-MM-DD')||'
> '||to_char(gmt_hour,'99')||':00:00-00','YYYY-MM-DD HH24:MI:SS') at time
> zone 'EST');
That seems like a mighty ugly way to do it; have you considered some
kind of timestamp arithmetic instead? But anyway, I suspect your
problem is you need a few 'FM' format specs to keep the to_char
functions from introducing unwanted spaces. Look at the intermediate
results of your expressions.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, jgw@alpinegeophysics.com
Subject: Re: Date/Time Conversion
In-Reply-To: <8222.1112500236@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox