From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Katka a Daniel Dunajsky <daniel_katka(at)hotmail(dot)com> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Time formating |
Date: | 2003-05-02 23:11:57 |
Message-ID: | 20030502160941.K77930-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, 2 May 2003, Katka a Daniel Dunajsky wrote:
> Hello All,
>
> This question is related to my preceeding question.
>
> How to format a value 7383 to represent 02H:03M:03SS (hours-minutes-seconds)
> using postgresql?
>
> I have this query:
>
> SELECT SUM (session_length))/60)/60 AS "Total",
> FROM user_sessions
> WHERE TO_CHAR(session_start, 'YYYY-MM') = '2003-04';
>
> If session_length = 7383 I will receive 2.
A better way would probably be something like:
SELECT INTERVAL '1 second' * session_length AS "Total"
...
> I have received advice that I should use . and it will work with
>
> select 5./2, however how to do it when I have a variable?
Use a cast of the general form CAST(<variable> as <type>).
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-05-02 23:19:41 | Re: Best way to delete time stamped data? |
Previous Message | Steve Crawford | 2003-05-02 22:51:53 | Re: Best way to delete time stamped data? |