Second, add 1 day to get the first day of the next month using DATE_ADD() function; Third, subtract 1 month to get the first day of the month of the date. I want to query the data base for "BETWEEN #date# AND #date#". Then we use realpath() which conveniently returns false if file does not exist. The LAST_DAY() function takes a date value as argument and returns the last day of month in that date.The date argument represents a valid date or datetime.. Syntax: Add this inside your form tag: 'Menu\Menu', Finally, you need to run the following command; php artisan dump-autoload I assume that you already added this package in composer.json Sorry, I didn't... Set short_open_tag=On in php.ini And restart your Apache server... have you tried using header('location') function? When used with PHP’s date function, the letter “t” acts as a format character that returns the number of days that are in a given month. $lastdateofmonth=date('t',$lastmonth);// this function will give you the number of days in given month (that will be last date of the month) The LAST_DAY() function in MySQL can be used to know the last day of the month for a given date or a datetime. This would be the last date from the given of a specified month. Then it's just a matter... autoload should be moved out of require-dev: { "require-dev":{ "phpunit/phpunit":"4.5. Which calendar to use is also a parameter but it would be rare to use anything other than CAL_GREGORIAN. We’ll use DATEADD to add a month to the date. date("Y-m-t", strtotime($dt)); ?> Sample Output: First day : 2008-02-01 - Last day : 2008-02-29 Flowchart : If you compare the unix timestamp directly you will only get results that match the exact second of the timestamp. So it means, literally you are inserting nothing into the database. function endOfMonth(date) { return new Date(date.getFullYear(), date.getMonth() + 1, 0); } dt = new Date(); console.log(endOfMonth(dt).toString()); Sample Output: Sat Jun 30 2018 00:00:00 GMT+0530 (India Standard Time) Flowchart: Live Demo: ... $x and $y are only defined within the scope of the function. So here's my current directory structure. How to register global variable for my Laravel application? Get the First Day of a Week, Month, Quarter or Year Note: You can just make a single file out of it to achieve your wanted output Use mysql_real_escape_string() to sanitize the passed-on value to prevent SQL injections You should use mysqli_* instead of the deprecated mysql_* API Form them in a single file like this (display.php):