Joining dates/times (was Re: [GENERAL] Splitting Timestamps)

2006-07-30 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Alvaro Herrera wrote: Chris Hoover wrote: I have several columns in my database that are timestamps. My developers are asking me how to split the timestamp so that they can look at either the date or at the time portion. I know I can do a

Re: Joining dates/times (was Re: [GENERAL] Splitting Timestamps)

2006-07-30 Thread Andreas Kretschmer
Ron Johnson [EMAIL PROTECTED] schrieb: I know I can do a select to_date(now(),'-mm-dd') and it will return the date. However, how do I get the time? Also, is this the proper way to get the date portion of a timestamp? select now()::timetz; select now()::time; select

Re: Joining dates/times (was Re: [GENERAL] Splitting Timestamps)

2006-07-30 Thread Martijn van Oosterhout
On Sun, Jul 30, 2006 at 10:00:30AM +0200, Andreas Kretschmer wrote: Ron Johnson [EMAIL PROTECTED] schrieb: I know I can do a select to_date(now(),'-mm-dd') and it will return the date. However, how do I get the time? Also, is this the proper way to get the date portion of a

Re: Joining dates/times (was Re: [GENERAL] Splitting Timestamps)

2006-07-30 Thread Tom Lane
Ron Johnson [EMAIL PROTECTED] writes: What's the inverse? Say I have a DATE and a TIME, and want to create a TIMESTAMP with them? Add 'em together, using the date + time or date + timetz operator: regression=# select current_date + '11:57'::time; ?column? -

[GENERAL] Splitting Timestamps

2006-07-25 Thread Chris Hoover
I have several columns in my database that are timestamps. My developers are asking me how to split the timestamp so that they can look at either the date or at the time portion.I know I can do a select to_date(now(),'-mm-dd') and it will return the date. However, how do I get the time? Also,

Re: [GENERAL] Splitting Timestamps

2006-07-25 Thread Alvaro Herrera
Chris Hoover wrote: I have several columns in my database that are timestamps. My developers are asking me how to split the timestamp so that they can look at either the date or at the time portion. I know I can do a select to_date(now(),'-mm-dd') and it will return the date. However,

Re: [GENERAL] Splitting Timestamps

2006-07-25 Thread A. Kretschmer
am 25.07.2006, um 12:54:35 -0400 mailte Chris Hoover folgendes: I have several columns in my database that are timestamps. My developers are asking me how to split the timestamp so that they can look at either the date or at the time portion. The CAST-Operater is your friend: est=# select

Re: [GENERAL] Splitting Timestamps

2006-07-25 Thread Curtis Scheer
I believe you would want to cast the field to a date like so select datefield::datefrom table1 or select datefield::time from table1. From: Chris Hoover [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 25, 2006 11:55 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Splitting

Re: [GENERAL] Splitting Timestamps

2006-07-25 Thread Reece Hart
On Tue, 2006-07-25 at 12:54 -0400, Chris Hoover wrote: I know I can do a select to_date(now(),'-mm-dd') and it will return the date. However, how do I get the time? Casting is the better option, but the to_date format spec handles a lot more than just dates. See:

Re: [GENERAL] Splitting Timestamps

2006-07-25 Thread Chris Browne
[EMAIL PROTECTED] (Chris Hoover) writes: I have several columns in my database that are timestamps.  My developers are asking me how to split the timestamp so that they can look at either the date or at the time portion. I know I can do a select to_date(now(),'-mm-dd') and it will return