Note that if we are using the only a month in our between command so for any year the range of month we specified will be returned by the query. for example for current month i want something like this 2015-03-01 00:00:00 - … To get the ISO week number (1-53) of a Date object, use date.getWeek(). SELECT * FROM dt_table WHERE `date` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 12 MONTH ) AND DATE_SUB( CURDATE( ) ,INTERVAL 6 MONTH ) With this you can understand how the records between a month range or a year range can be collected from a table. This value is derived from the operating system of the computer on which the instance of SQL Server is running. Previous Previous post: get date range for current week in php. i tried like: ... want to get current financial year. Create a Date With mktime() The optional timestamp parameter in the date() function specifies a timestamp. The easiest way to convert a date from a format (here yyyy-mm-dd) to another. The first function returns the ISO 8601 week for a given date, whereas the second one returns the number in many different modes (see documentation for details). In other words, if today is wednesday, I'm looking to find the date range of the previous Sunday to Saturday. One thing I wanted to do was show the data for a quarter, but graphing by day is too chaotic and graphing by month only gives three points, so I wanted to graph by week. how do generate in particular month and year Some examples are: