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?
-
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
> > >>
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;
> >
-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
[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 re
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:
http://www.postgresql.
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
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=# sel
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. How