Re: Fixing faulty dates - select on day part of a date field
От | Markus Bertheau |
---|---|
Тема | Re: Fixing faulty dates - select on day part of a date field |
Дата | |
Msg-id | 1007035567.1110.1.camel@entwicklung01.cenes.de обсуждение исходный текст |
Ответ на | Fixing faulty dates - select on day part of a date field (Gary Stainburn <gary.stainburn@ringways.co.uk>) |
Ответы |
Re: Fixing faulty dates - select on day part of a date field
|
Список | pgsql-sql |
On Thu, 2001-11-29 at 12:31, Gary Stainburn wrote: > I've got a problem with dates on one of my tables. I've been inserting dates > in the format 'dd/mm/ccyy' which for the days 13-31 for each month worked > fine. > > The problem I have is that for the days 01-12 for each month, the date was > interpretted as 'mm/dd/ccyy'. Now I know about it I need to fix it. > > Two questions. > > 1) how can I select on part of a date? I need to select all records where > the day is not > 12. select date_part('part', attribute) where part is one of week, day, year ans so on standards compliant way is select extract(part from attribute) so: select * from table where date_part('day', attribute) < 13; > 2) can I do this in a single update, i.e. can I do something around > > update calls set xdate = ???? where ??????; What exactly do you want to achieve? Markus Bertheau
В списке pgsql-sql по дате отправления: