Re: Retrieve the month from a date field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shaun,

SELECT * FROM tblYourTableName WHERE month(yourDateColumnName) = 4

Be careful, as this will select all years (you may not want this). If you only want a certain month in a certain year, try this:

SELECT * FROM tblYourTableName WHERE month(yourDateColumnName) = 4 AND year(yourDateColumnName) = 2003

Adam

Hi,

I have a date field in my table (YYYY-MM-DD). Is it possible to retrieve all
the rows that occur in a given month i.e. April?


Thanks for your help

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux