pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedQuestion about time
4+ messages / 4 participants
[nested] [flat]
* Question about time
@ 2006-11-16 16:14 Judith <jaltamirano@correolux.com.mx>
2006-11-16 22:23 ` Re: Question about time Joe <dev@freedomcircle.net>
2006-11-16 22:27 ` Re: Question about time Phillip Smith <phillips@weatherbeeta.com.au>
0 siblings, 2 replies; 4+ messages in thread
From: Judith @ 2006-11-16 16:14 UTC (permalink / raw)
To: pgsql-sql
Hi everyone I'm doing a query like this:
SELECT CAST(fecha_hora_factura as time) FROM nota_venta
and I get:
14:16:52.824395
the field is timestamp type....... I just want the HOUR:MINUTE:SECOND
the question is how I drop the millisecond??
Thnx in advanced!!!
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Question about time
2006-11-16 16:14 Question about time Judith <jaltamirano@correolux.com.mx>
@ 2006-11-16 22:23 ` Joe <dev@freedomcircle.net>
2006-11-16 23:19 ` Re: Question about time Hector Villarreal <HVillarreal@mynewplace.com>
1 sibling, 1 reply; 4+ messages in thread
From: Joe @ 2006-11-16 22:23 UTC (permalink / raw)
To: Judith <jaltamirano@correolux.com.mx>; +Cc: pgsql-sql
On Thu, 2006-11-16 at 10:14 -0600, Judith wrote:
> Hi everyone I'm doing a query like this:
>
> SELECT CAST(fecha_hora_factura as time) FROM nota_venta
>
> and I get:
>
> 14:16:52.824395
>
> the field is timestamp type....... I just want the HOUR:MINUTE:SECOND
>
> the question is how I drop the millisecond??
Take a look at date_trunc() under Date/Time Functions and Operators.
Joe
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Question about time
2006-11-16 16:14 Question about time Judith <jaltamirano@correolux.com.mx>
2006-11-16 22:23 ` Re: Question about time Joe <dev@freedomcircle.net>
@ 2006-11-16 23:19 ` Hector Villarreal <HVillarreal@mynewplace.com>
0 siblings, 0 replies; 4+ messages in thread
From: Hector Villarreal @ 2006-11-16 23:19 UTC (permalink / raw)
To: Joe <dev@freedomcircle.net>; Judith <jaltamirano@correolux.com.mx>; +Cc: pgsql-sql
Try this one:
SELECT date_trunc('seconds',now())::time;
"15:11:42"
So it should be select date_trunc('seconds', fecha_hora_factura)::time
from nota_venta;
-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Joe
Sent: Thursday, November 16, 2006 2:24 PM
To: Judith
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Question about time
On Thu, 2006-11-16 at 10:14 -0600, Judith wrote:
> Hi everyone I'm doing a query like this:
>
> SELECT CAST(fecha_hora_factura as time) FROM nota_venta
>
> and I get:
>
> 14:16:52.824395
>
> the field is timestamp type....... I just want the
HOUR:MINUTE:SECOND
>
> the question is how I drop the millisecond??
Take a look at date_trunc() under Date/Time Functions and Operators.
Joe
---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at
http://www.postgresql.org/about/donate
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Question about time
2006-11-16 16:14 Question about time Judith <jaltamirano@correolux.com.mx>
@ 2006-11-16 22:27 ` Phillip Smith <phillips@weatherbeeta.com.au>
1 sibling, 0 replies; 4+ messages in thread
From: Phillip Smith @ 2006-11-16 22:27 UTC (permalink / raw)
To: 'Judith' <jaltamirano@correolux.com.mx>; pgsql-sql
Try the to_char() function instead of cast()
SELECT to_char(fecha_hora_factura, 'HH:MM:SS') FROM nota_venta
Cheers,
-p
-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of Judith
Sent: Friday, 17 November 2006 5:14 AM
To: pgsql-sql@postgresql.org
Subject: [SQL] Question about time
Hi everyone I'm doing a query like this:
SELECT CAST(fecha_hora_factura as time) FROM nota_venta
and I get:
14:16:52.824395
the field is timestamp type....... I just want the HOUR:MINUTE:SECOND
the question is how I drop the millisecond??
Thnx in advanced!!!
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faq
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-11-16 23:19 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-11-16 16:14 Question about time Judith <jaltamirano@correolux.com.mx>
2006-11-16 22:23 ` Joe <dev@freedomcircle.net>
2006-11-16 23:19 ` Hector Villarreal <HVillarreal@mynewplace.com>
2006-11-16 22:27 ` Phillip Smith <phillips@weatherbeeta.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