pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
timestamp with timezone
5+ messages / 3 participants
[nested] [flat]

* timestamp with timezone
@ 2003-09-12 17:41 Shankar K <shan0075@yahoo.com>
  2003-09-13 00:09 ` Re: timestamp with timezone Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Shankar K @ 2003-09-12 17:41 UTC (permalink / raw)
  To: pgsql-admin

Folks,

Our databases stores most of the dates as timestamp
with timezone format, so the data looks like this...

09/12/2003 12:51:31.268 PDT
09/12/2003 12:50:20 PDT

some has centiseconds in them along with TZ. Now i'm
wondering is there a way to just extract date and
timestamp alone leaving the centisecods as well the TZ
part. 

does pg_dump utility has any options to trunc this
while it exports data ?

cheers,
shankar

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: timestamp with timezone
  2003-09-12 17:41 timestamp with timezone Shankar K <shan0075@yahoo.com>
@ 2003-09-13 00:09 ` Tom Lane <tgl@sss.pgh.pa.us>
  2003-09-13 01:36   ` Re: timestamp with timezone Shankar K <shan0075@yahoo.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2003-09-13 00:09 UTC (permalink / raw)
  To: Shankar K <shan0075@yahoo.com>; +Cc: pgsql-admin

Shankar K <shan0075@yahoo.com> writes:
> some has centiseconds in them along with TZ. Now i'm
> wondering is there a way to just extract date and
> timestamp alone leaving the centisecods as well the TZ
> part. 

You mean you want to round off to even seconds?  Try date_trunc,
or cast to "timestamp(0) with time zone".  To force stuff to be
rounded when it's stored, declare the column like that in the
first place.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: timestamp with timezone
  2003-09-12 17:41 timestamp with timezone Shankar K <shan0075@yahoo.com>
  2003-09-13 00:09 ` Re: timestamp with timezone Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-09-13 01:36   ` Shankar K <shan0075@yahoo.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Shankar K @ 2003-09-13 01:36 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

> You mean you want to round off to even seconds?  Try
> date_trunc,
> or cast to "timestamp(0) with time zone".  

well, i just need to trunc whatever thats after the
timestamp i.e from 06/10/2003 12:50:19.188 PDT, i need
to remove .188 PDT

i'll see if date_trunc helps me or not. thanks for the
suggestions tom.

>To force stuff to be
> rounded when it's stored, declare the column like
> that in the
> first place.
>
yeah, i wish the 3rd party apps had 'timestamp without
timezone' as the default for all date columns but it
isn't :(

anyways, reason behind the whole truncating TZ is
that, we basically copy the data from postgres to
oracle on a nightly batch process for our data
warehousing requirements, but oracle upto 8.1.7.x
doesn't support timestamp with timezone datatype, so
we are kind of stuck with spooling required
tables/formating dates to oracle compatible formats
and then use sql*loader to upload the data into
oracle.

not sure how well i can imporve this whole ETL
process. Any suggestions are greatly appreciated.

Thanks
Shankar

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: timestamp with timezone
@ 2003-09-12 17:47 Shankar K <shan0075@yahoo.com>
  2003-09-12 19:45 ` Re: timestamp with timezone Bruno LEVEQUE <bruno.leveque@net6d.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Shankar K @ 2003-09-12 17:47 UTC (permalink / raw)
  To: pgsql-admin

oops forgot to mention, database version is 7.3.2

--- Shankar K <shan0075@yahoo.com> wrote:
> Folks,
> 
> Our databases stores most of the dates as timestamp
> with timezone format, so the data looks like this...
> 
> 09/12/2003 12:51:31.268 PDT
> 09/12/2003 12:50:20 PDT
> 
> some has centiseconds in them along with TZ. Now i'm
> wondering is there a way to just extract date and
> timestamp alone leaving the centisecods as well the
> TZ
> part. 
> 
> does pg_dump utility has any options to trunc this
> while it exports data ?
> 
> cheers,
> shankar
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site
> design software
> http://sitebuilder.yahoo.com
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: timestamp with timezone
  2003-09-12 17:47 Re: timestamp with timezone Shankar K <shan0075@yahoo.com>
@ 2003-09-12 19:45 ` Bruno LEVEQUE <bruno.leveque@net6d.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Bruno LEVEQUE @ 2003-09-12 19:45 UTC (permalink / raw)
  To: pgsql-admin

I think you could choose between two solutions (at least) :

1 - Insert date and time in place of timestamp
2 - use some functions like substring. Something like :
  select substring('09/12/2003 12:51:31.268 PDT' from '../../.... ..:..:..')

Bruno

Shankar K wrote:

>oops forgot to mention, database version is 7.3.2
>
>--- Shankar K <shan0075@yahoo.com> wrote:
>  
>
>>Folks,
>>
>>Our databases stores most of the dates as timestamp
>>with timezone format, so the data looks like this...
>>
>>09/12/2003 12:51:31.268 PDT
>>09/12/2003 12:50:20 PDT
>>
>>some has centiseconds in them along with TZ. Now i'm
>>wondering is there a way to just extract date and
>>timestamp alone leaving the centisecods as well the
>>TZ
>>part. 
>>
>>does pg_dump utility has any options to trunc this
>>while it exports data ?
>>
>>cheers,
>>shankar
>>
>>__________________________________
>>Do you Yahoo!?
>>Yahoo! SiteBuilder - Free, easy-to-use web site
>>design software
>>http://sitebuilder.yahoo.com
>>
>>    
>>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>  
>

-- 
Bruno LEVEQUE
System Engineer
SARL NET6D
bruno.leveque@net6d.com
http://www.net6d.com




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-09-13 01:36 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-12 17:41 timestamp with timezone Shankar K <shan0075@yahoo.com>
2003-09-13 00:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-09-13 01:36   ` Shankar K <shan0075@yahoo.com>
2003-09-12 17:47 Re: timestamp with timezone Shankar K <shan0075@yahoo.com>
2003-09-12 19:45 ` Bruno LEVEQUE <bruno.leveque@net6d.com>

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