Re: [GENERAL] CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP
От | Jose Soares |
---|---|
Тема | Re: [GENERAL] CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP |
Дата | |
Msg-id | 38BBCB88.39ECAF85@sferacarta.com обсуждение исходный текст |
Ответ на | CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP ("sheila bel" <sheilabel@hotmail.com>) |
Список | 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@sferacarta.com
В списке pgsql-general по дате отправления: