date_part is a synonym for extract w/ more normal syntax so you could write func.date_part('year', mydatetime)
On 1/22/07, laurent rahuel <[EMAIL PROTECTED]> wrote: > > Hi, > > Here is my little trouble. I want to extract some parts of a datetime > field in a postgresql database. > > I played around with the func.year(), func.month() but it sounds like > postgresql doesn't understand the resulting query. For example, a > func.year() call is converted into : > > select year(myDateTime) from mytable; > > This works with MySQL but not with Postgresql. The error is "function > year(timestamp without time zone) doesn't exist" > > I guess the resulting Postgresql query should be : > > select EXTRACT (year FROM myDateTime) from mytable; > > Any clue ??? > > Regards, > > Laurent > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---