Re: How to convert postgres timestamp to date: yyyy-mm-dd
В списке pgsql-general по дате отправления:
| От | Thomas Kellerer |
|---|---|
| Тема | Re: How to convert postgres timestamp to date: yyyy-mm-dd |
| Дата | |
| Msg-id | fr6tqu$q8v$1@ger.gmane.org обсуждение исходный текст |
| Ответ на | Re: How to convert postgres timestamp to date: yyyy-mm-dd ("A. Kretschmer" <andreas.kretschmer@schollglas.com>) |
| Список | pgsql-general |
A. Kretschmer wrote on 11.03.2008 19:50: > am Tue, dem 11.03.2008, um 10:51:21 -0700 mailte CaseT folgendes: >> Hi All, >> >> I'm a novice but learning quickly and I'm stumped on how to do this. >> >> I need to convert postgres timestamp to date format yyyy-mm-dd in a >> sql statement. >> pt.created_date below is timestamp format >> >> i.e ... WHERE pt.created_date >= '2008-01-21' > > You can't compare a date or timestamp to a varchar or text. For your > example, cast the date-string to a real date like: > > ... WHERE pt.created_date >= '2008-01-21'::date > You can also use the ANSI standard for specifying date literals: WHERE pt.created_date >= DATE '2008-01-21' which will work with other (standard compliant) DBMS as well. Thomas
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера