Find second and fourth saturday's of the month in PHP-MySql
Posted by Raj
Find second and fourth saturday's of the month in PHP-MySql
In this section, I have created simple script in PHP to find second(2nd) and fourth(4th) Saturday of the month.
You can use this PHP script to find second and fourth saturday of particular month and year.
In this section, I have created simple script in PHP to find second(2nd) and fourth(4th) Saturday of the month.
<?php
// Mysql Connection
$conn = mysql_connect('localhost','root','');
if (!$conn) {
die('Could not connect to MySQL: ' . mysql_error());
}
echo 'Connection OK'; mysql_close($conn);
// Select Database
mysql_select_db("test");
// Array of the Month's
$month_array=array("jan","Feb","Mar","Apr","May","Jun","july",'Aug',"Sep","Oct","Nov","Dec");
// Array of the Years's
$year_array=array("2013","2014");
foreach($year_array as $year)
{
foreach($month_array as $month)
{
echo $second=date('Y-m-d', strtotime("second sat of $month $year"));
echo "<br>";
echo $fourth=date('Y-m-d', strtotime("fourth sat of $month $year"));
echo "<br>";
}
}
?>
You can use this PHP script to find second and fourth saturday of particular month and year.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
mysql,
PHP
.You can leave a response, or trackback from your own site.