How to find day from specific date in PHP?

How to find day from specific date in PHP?

In this post we will give you information about How to find day from specific date in PHP?. Hear we will give you detail about How to find day from specific date in PHP?And how to use it also give you demo for it if it is necessary.

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);

var_dump($specificDate);

// Using DateTime Object

$yourDate = "2011-12-2";

$yourDate = DateTime::createFromFormat("Y-m-d", $yourDate);

var_dump($yourDate->format("l"));

Hope this code and post will helped you for implement How to find day from specific date in PHP?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  1  =  6

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US