How to find day from specific date in PHP?By Hardik Savani | February 3, 2016 | | 656 Viewer | Category : PHP
Share this post:
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);
- How to get latitude longitude from mysql in laravel 5?
- How to scrolling table with fixed header in HTML?
- Laravel 5 amazon s3 file upload tutorial - Part 1
- How to add tooltip Bootstrap?
- How to create custom helper in Laravel 5?
- MySql comma separated column join in PHP Laravel 5
- Select box with search option example in Jquery using Chosen Plugin
- Laravel 5 - Simple user access control using Middleware