0

Hi, I am using a date in DB in this format 2004-07-15
and Showing the date in the format 15-July-2004 using this code

echo "<tr>";
  echo "<th bgcolor=#FFCC00>LA Start Date</th>";
  echo "<td bgcolor=#FEE9A9>" .date("j-F-Y",strtotime($row['LAPeriodStart'])). "</td>";
    echo "</tr>";

Now I want all the records from this date field for the month of July.
How I can get all the records for month acording to my option.
please guide me.

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by ayesha789
0

Please guide me becuase i have no idea of it.
If i have seperate field for month its easy but i want to extract month from this and want to show id where month is july.

0

well you can explode the date format and make a string which suits the format of date in Database..!!!

0

If you want to choose all of the records from the db for July of the current year you can do a select such as:
Select ... where date like '2009-07-%'

if you want all July records for any year the it would be:
Select ... where date like '%-07-%'

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.