How to find day from specific date in PHP?By Hardik Savani | February 3, 2016 | | 1194 Viewer | Category : PHP
Whenever you need to det day like Monday, Tuesday etc from full date. i mean you have any specific date like "2015-10-10" and you want to get day then you can do in both way first using strtotime() and second using DateTime object.
In Following example you can see i give you both way to get day from your date. now i added format 'l' so it will return full name of day like "Tuesday", but if you want to get short name of day then you can change format like "D".
// Using strtotime()
$specificDate = strtotime('2016-2-3');
$specificDate = date('l', $specificDate);
// Using DateTime Object
$yourDate = "2011-12-2";
$yourDate = DateTime::createFromFormat("Y-m-d", $yourDate);
- Laravel 5 - Example of Database Seeder with insert sample data
- How to use where clause with mysql function in Laravel 5?
- How to add text on image in laravel 5?
- Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.
- How to check request method is GET or POST in Laravel?
- How to optimize website speed and performance in Laravel 5.5 ?
- PHP - multiple file uploading dropzone js example
- Laravel 5 Google OAuth authentication using Socialite Package