U
U
Us592019-12-21 16:37:55
PHP
Us59, 2019-12-21 16:37:55

How to change the date?

There is a date in the format: It is 2020-11-27

required to add +1 day to 27 and decrease by 1 year, as a result we should get: 28-11-2019

Then I display the date itself like this:

DateTime::createFromFormat('Y-m-d', $date)->format('F d, Y')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bedolazhka, 2019-12-21
@Us59

$date = '2020-11-27';
echo DateTime::createFromFormat('Y-m-d', $date)->modify('+ 1 day - 1 year')->format('F d, Y');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question