PHP Get date with day of the week [duplicate] - php

This question already has answers here:
Convert one date format into another in PHP
(17 answers)
Closed 3 years ago.
How can I get the full name of the day of the week in PHP like Monday or Friday?

try:
echo date('D, d M Y h:i:s');
https://www.php.net/manual/en/function.date.php

Related

Convert time data into human readable time using PHP [duplicate]

This question already has answers here:
Convert one date format into another in PHP
(17 answers)
Closed 2 years ago.
I have a time value in the following data format:
"2020-08-05T11:45:10.3159677Z"
How do I convert it to something human readable, like as follows, using PHP?
Wednesday, August 5, 2020, 11:45 AM
Try this:
echo date("H:i A, F jS, Y", strtotime("2020-08-05T11:45:10.3159677Z"));

change date and time format in php [duplicate]

This question already has answers here:
Convert one date format into another in PHP
(17 answers)
Closed 5 years ago.
I am fetching time and date from MYSQLi using php. For time I am getting default 24 hr format and for date I am recieving format of y/m/d.
I want to get time in 12 hr format.
I want to get date in d/m/y format.
How to do it in php ?
In pure simple php, you can write as follow
Date
echo date('d/m/Y', strtotime($your_date));
Time
echo date('H:i', $your_time);
For the 12 hours, use
echo date('g:i A', $your_time);

calculate last date, given start date and month PHP [duplicate]

This question already has answers here:
Adding three months to a date in PHP
(11 answers)
Closed 6 years ago.
There is a start date(let it be 16/02/2016) and months(let it be 3 months) given to me.
how do I calculate the end date?
This will help you
$myDate = "16-02-2016";
$final_date = date('Y-m-d', strtotime("+3 months", strtotime($myDate)));

Get the current month in full text in php [duplicate]

This question already has answers here:
Convert one date format into another in PHP
(17 answers)
Closed 7 years ago.
I want to echo the current month in full text. eg : june;
echo date('M');
// result jun.
but i want to display full month. how can i do that.
You can use date with F (have a look at the docs).
So date("F") will output June.

Obtain a month is a few days? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
PHP iterate days of month given month and year
"Obtain all days in month with the number of months"
For example i have date 2011/12/16 this date have months 12(december) now i want with code php know that, This month(12 or december) is a few days?(29? or 31? or 30?)
How is it by PHP?
$mydate = strtotime('2011/12/16');
$daysInMonth = date('t',$mydate);
Edited to add strtotime()

Categories