D
D
doitden2014-09-04 16:09:29
PHP
doitden, 2014-09-04 16:09:29

How to get the date in the form (yyyy-md) from the textual representation of the date (October 22, 2012)?

that is, from the date (October 22, 2012) - get 2012-10-22 Tell me
the functions or libraries that will help solve this problem in php.
In principle, you can implement it yourself. But still, are there any ready-made solutions?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Skogorev, 2014-09-04
@doitden

strtotime

M
Melkij, 2014-09-04
@melkij

As well as the regular datetime class
php.net/manual/en/class.datetime.php

A
Alexander Zelenin, 2014-09-04
@zelenin

strtotime is good, but deprecated and not universal.
$date = Datetime::createFromFormat(.......); // offsite syntax
echo $date->format('Ymd');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question