What is the opposite of the date of the PHP () function?

Is there any function in PHP that either accepts a date, or turns it into a timestamp, or can just accept a date in one format and change it to another format? I have a date set in m d format that I want to change to l, F d, Y.

I will need this with dates in other formats, so a function that allows me to specify the date, input format and output format.

+3
source share
3 answers

DateTime::createFromFormat

Returns a new DateTime object formatted according to the specified format

For output in a new format, you have

DateTime::format

Or to mark the time

DateTime::getTimestamp

+1
source
+4

strtotime() :

date ( "l, F d, Y", strtotime ($ YOUR_MD_DATE));

,
.

0

Source: https://habr.com/ru/post/1753968/


All Articles