is there a way to get hh:mm:ss given seconds

Поиск
Список
Период
Сортировка
Искать

is there a way to get hh:mm:ss given seconds

От:
"Narendra A" <narendraa@subexgroup.com>
Дата:

Sir,

Is there a way in sql such that if I give seconds it should me return me hours:mins:seconds

 

Eg. Seconds     hh:mm:ss

422              1:01:02

 

eagerly waiting for response.

 

Regards

Narendra


DISCLAIMER: This email is bound by the terms and conditions described at
http://www.subexgroup.com/mail-disclaimer.htm

Re: is there a way to get hh:mm:ss given seconds

От:
David Stanaway <david@stanaway.net>
Дата:
On Mon, 2002-07-08 at 09:28, Narendra A wrote:
> Sir,
> Is there a way in sql such that if I give seconds it should me return me
> hours:mins:seconds
> 
> Eg. Seconds     hh:mm:ss
> 422              1:01:02


scratch=# SELECT 422::interval;interval 
----------00:07:02
(1 row)

scratch=# \q
dstanawa@ciderbox:~$ bc -l
7*60+2
422

I don't know where you got 1:01:02 from.


--
David Stanaway

Re: is there a way to get hh:mm:ss given seconds

От:
Tod McQuillin <devin@spamcop.net>
Дата:
On Mon, 8 Jul 2002, Narendra A wrote:

> Is there a way in sql such that if I give seconds it should me return me
> hours:mins:seconds
>
> Eg. Seconds     hh:mm:ss
> 422              1:01:02

foo=# select '422 seconds'::interval;interval
----------00:07:02
(1 row)
-- 
Tod McQuillin





Re: is there a way to get hh:mm:ss given seconds

От:
Kevin Brannen <kevinb@nurseamerica.net>
Дата:
Tod McQuillin wrote:
> On Mon, 8 Jul 2002, Narendra A wrote:
> 
> 
>>Is there a way in sql such that if I give seconds it should me return me
>>hours:mins:seconds
>>
>>Eg. Seconds     hh:mm:ss
>>422              1:01:02
> 
> 
> foo=# select '422 seconds'::interval;
>  interval
> ----------
>  00:07:02
> (1 row)


That works on inserts into a "time" field too, cool tip.  THANKS!

Kevin


Re: is there a way to get hh:mm:ss given seconds

От:
"Josh Berkus" <josh@agliodbs.com>
Дата:
Narendra,

> I tried all these. This is what I get
> SQL> SELECT "interval"(cast(422 as varchar) || ' seconds');
> SELECT "interval"(cast(422 as varchar) || ' seconds')
>                                      *
> ERROR at line 1:
> ORA-00906: missing left parenthesis

> SQL> select '422 seconds'::interval;
> select '422 seconds'::interval
>                     *
> ERROR at line 1:
> ORA-00923: FROM keyword not found where expected

Those don't look like PostgreSQL error messages.  I think you are using
some other database.

-Josh Berkus

Re: is there a way to get hh:mm:ss given seconds

От:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Дата:
> > I tried all these. This is what I get
> > SQL> SELECT "interval"(cast(422 as varchar) || ' seconds');
> > SELECT "interval"(cast(422 as varchar) || ' seconds')
> >                                      *
> > ERROR at line 1:
> > ORA-00906: missing left parenthesis
> 
> > SQL> select '422 seconds'::interval;
> > select '422 seconds'::interval
> >                     *
> > ERROR at line 1:
> > ORA-00923: FROM keyword not found where expected
> 
> Those don't look like PostgreSQL error messages.  I think you are using
> some other database.

Yes - he's using Oracle.  I think Narendra is rather confused...

Chris


FAQ