pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedis there a way to get hh:mm:ss given seconds
6+ messages / 6 participants
[nested] [flat]
* is there a way to get hh:mm:ss given seconds
@ 2002-07-08 14:28 Narendra A <narendraa@subexgroup.com>
0 siblings, 2 replies; 6+ messages in thread
From: Narendra A @ 2002-07-08 14:28 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: is there a way to get hh:mm:ss given seconds
@ 2002-07-09 14:41 Tod McQuillin <devin@spamcop.net>
parent: Narendra A <narendraa@subexgroup.com>
1 sibling, 1 reply; 6+ messages in thread
From: Tod McQuillin @ 2002-07-09 14:41 UTC (permalink / raw)
To: Narendra A <narendraa@subexgroup.com>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: is there a way to get hh:mm:ss given seconds
@ 2002-07-09 14:58 David Stanaway <david@stanaway.net>
parent: Narendra A <narendraa@subexgroup.com>
1 sibling, 0 replies; 6+ messages in thread
From: David Stanaway @ 2002-07-09 14:58 UTC (permalink / raw)
To: narendraa@subexgroup.com; +Cc: pgsql-sql
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
Attachments:
signature.asc (application/pgp-signature, 480B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: is there a way to get hh:mm:ss given seconds
@ 2002-07-09 19:11 Kevin Brannen <kevinb@nurseamerica.net>
parent: Tod McQuillin <devin@spamcop.net>
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Brannen @ 2002-07-09 19:11 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: is there a way to get hh:mm:ss given seconds
@ 2002-07-10 05:46 Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 6+ messages in thread
From: Josh Berkus @ 2002-07-10 05:46 UTC (permalink / raw)
To: narendraa@subexgroup.com; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: is there a way to get hh:mm:ss given seconds
@ 2002-07-10 05:49 Christopher Kings-Lynne <chriskl@familyhealth.com.au>
parent: Josh Berkus <josh@agliodbs.com>
0 siblings, 0 replies; 6+ messages in thread
From: Christopher Kings-Lynne @ 2002-07-10 05:49 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; narendraa@subexgroup.com; +Cc: pgsql-sql
> > 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
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2002-07-10 05:49 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-08 14:28 is there a way to get hh:mm:ss given seconds Narendra A <narendraa@subexgroup.com>
2002-07-09 14:41 ` Tod McQuillin <devin@spamcop.net>
2002-07-09 19:11 ` Kevin Brannen <kevinb@nurseamerica.net>
2002-07-09 14:58 ` David Stanaway <david@stanaway.net>
2002-07-10 05:46 Re: is there a way to get hh:mm:ss given seconds Josh Berkus <josh@agliodbs.com>
2002-07-10 05:49 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
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