From: | Jose Soares <jose(at)sferacarta(dot)com> |
---|---|
To: | sheila bel <sheilabel(at)hotmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: [GENERAL] CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP |
Date: | 2000-02-29 13:37:12 |
Message-ID: | 38BBCB88.39ECAF85@sferacarta.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
sheila bel wrote:
> Hi all,
>
> I wanted to get some information about date and time
> stamps and examples of how to use them. In the User
> Manual I got referred to functions called CURRENT_DATE,
> CURRENT_TIME. I have been literally searching for
> hours to find more about them in all the PostgreSQL
> manuals, I've used ALL the search engines and did not
> find anything. If there is a reference to them they should
> be somewhere in there, right?
> I'm sorry but dear developers your manual is not user
> friendly at all :(
> A lot of time gets wasted on finding the information you
> need or not finding them at all.
>
> -Sheila
You ca use the niladics datetime functions:
- CURRENT_DATE
- CURRENT_TIME
- CURRENT_TIMESTAMP
as a column default value like:
CREATE TABLE mytb (
mydt DATE DEFAULT CURRENT_DATE,
mytm TIME DEFAULT CURRENT_TIME,
myts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
to insert a value into a column as in:
INSERT INTO mytb (mydt) VALUES(CURRENT_DATE);
to compare two values as in:
SELECT * FROM mytb WHERE mytm BETWEEN '1999-12-31 12:30:00' AND
CURRENT_TIMESTAMP;
etc, etc...
--
Jose' Soares
Bologna, Italy Jose(at)sferacarta(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff MacDonald | 2000-02-29 13:53:21 | Another Database Poll |
Previous Message | Tatsuo Ishii | 2000-02-29 01:17:31 | Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0) |