Hi all
Finally, I am using a plpgsql procedure that accomplish that in
PostgreSQL 7.2.1. The code follows:
CREATE OR REPLACE FUNCTION utc_date_trunc (TEXT, TIMESTAMP) RETURNS
TIMESTAMP AS '
DECLARE
utcts TIMESTAMP WITHOUT TIME ZONE;
utcdt TIMESTAMP WITHOUT TIME ZONE;
BEGIN
--> First get
Hi Richard
Ok, I'll do my best to explain clearer ;)
I have to make some monthly reports about some service requests
activity. So, I'm keeping in a table the monthly traffic.
TABLE traffic
+-+++
| service | month | visits |
+-+---
Thrasher <[EMAIL PROTECTED]> writes:
> The biggest point that I see is that it would be nice to have some kind
> of function that works with UTC values, regarding of which timezone the
> user has set.
You can do that in 7.3, using the AT TIME ZONE construct. Observe:
regression-# begin;
BEGIN
The biggest point that I see is that it would be nice to have some kind
of function that works with UTC values, regarding of which timezone the
user has set. Let's say, something like
SELECT UTC_DATE_TRUNC ('month', NOW ());
utc_date_trunc
2002-11-01 01:00:00+01
Richard Huxton <[EMAIL PROTECTED]> writes:
> Hmm - good point. You can revert to the client default but not to the
> previous value. I don't know of any way to read these SET values
> either - a quick poke through pg_proc didn't show anything likely.
In 7.3 you can use current_setting() and set_co
On Wednesday 20 Nov 2002 3:40 pm, Juan Fernandez wrote:
> Hi Richard
>
> Ok, I'll do my best to explain clearer ;)
I'll do my best to be of some use ;-)
> I have to make some monthly reports about some service requests
> activity. So, I'm keeping in a table the monthly traffic.
>
> TABLE traffic
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', ) = DATE_TRUNC('month',
> ).
Sorry, I've obviously misunderstood. Are you just looking to discard the
timez
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', ) = DATE_TRUNC('month',
).
Richard Huxton wrote:
On Wednesday 20 Nov 2002 9:44 am, Thrasher wrote:
Hi
I do not know if it's an error, but in this query
=# sel
On Wednesday 20 Nov 2002 9:44 am, Thrasher wrote:
> Hi
>
> I do not know if it's an error, but in this query
>
> =# select date_trunc ('month', now ());
> date_trunc
>
> 2002-11-01 00:00:00+01
> (1 row)
>
> I've got the truncated date dependant to my timezone.
>
>
Hi
I do not know if it's an error, but in this query
=# select date_trunc ('month', now ());
date_trunc
2002-11-01 00:00:00+01
(1 row)
I've got the truncated date dependant to my timezone.
Instead, I would like to have as a result
2002-11-01 01:00:00+01
which
10 matches
Mail list logo