pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Thrasher <thrasher@fibers.upc.es>
Cc: pgsql-sql@postgresql.org
Subject: Re: Date trunc in UTC
Date: Wed, 20 Nov 2002 13:06:47 +0000
Message-ID: <200211201306.47345.dev@archonet.com> (raw)
In-Reply-To: <3DDB65ED.70101@fibers.upc.es>
References: <3DDB5991.9060706@fibers.upc.es>
	<200211201024.17210.dev@archonet.com>
	<3DDB65ED.70101@fibers.upc.es>

On Wednesday 20 Nov 2002 10:37 am, Thrasher wrote:
> No I cannot use SET TIME ZONE.
>
> SET TIME ZONE will be set by any client backend. But what I want to get
> is that DATE_TRUNC('month', <now in timezone +1>) = DATE_TRUNC('month',
> <now in timezone -7>).

Sorry, I've obviously misunderstood. Are you just looking to discard the 
timezone so they look the same?

select date_trunc('month', CAST(CURRENT_TIMESTAMP AS timestamp without time 
zone));
     date_trunc
---------------------
 2002-11-01 00:00:00

I'd have thought that would give you some problems around local/utc midnight 
on the first of the month.

Or is it that you want to know what time it was in UTC zone at the start of 
the month local time?

If I'm still being a bit slow (quite likely) can you explain what you're using 
this for?

> >>=# select date_trunc ('month', now ());
> >>        date_trunc
> >>------------------------
> >>  2002-11-01 00:00:00+01

> >>Instead, I would like to have as a result
> >>
> >>  2002-11-01 01:00:00+01
> >>
> >>which is correct, but I cannot set the whole server to UTC. Any way to
> >>get this ?

-- 
  Richard Huxton



view thread (10+ messages)  latest in thread

Message-ID: <200211201306.47345.dev@archonet.com>
Permalink:  ../200211201306.47345.dev@archonet.com/
Also on:    postgresql.org/message-id/200211201306.47345.dev@archonet.com

 · 

reply

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: dev@archonet.com, thrasher@fibers.upc.es
  Subject: Re: Date trunc in UTC
  In-Reply-To: <200211201306.47345.dev@archonet.com>

* 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