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.

Recommended Answers

All 5 Replies

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.

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

anyone can guide?

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-%'

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.