How to change date string format using PHP?
From: 06/16/2010To:2010-06-16
06/16/2010
2010-06-16
$date = "06/16/2010"; echo date('Y-m-d', strtotime($date)); // outputs 2010-06-16
Using the strtotime function .
php -r 'echo date("Y-m-d", strtotime("06/16/2010"));'
You should use \DateTimeand get rid of the lines as soon as possible:
\DateTime
$date = DateTime::createFromFormat('m/d/Y', '06/16/2010'); // \DateTime object echo $date->format('Y-m-d'); // 2010-06-16
More details:http://php.net/manual/en/datetime.createfromformat.php
Source: https://habr.com/ru/post/1750783/More articles:Как получить структуру модуля с помощью ToolsAPI в Delphi? - delphiGames for iPhone - c ++How to apply style for WPF DATAGRID Scroll Bars - wpfdatagridVilla Perl CGI Cloning Request Headers for LWP UserAgent - perlOffer for richtextbox online HTML code generator on web page - javascriptGet selected webpage text in google chrome extension - javascriptВ чем разница между указателем на функцию и указателем на функцию WINAPI? - c++is a decorator in python exactly the same as calling a function on a function? - pythonHow to disable a Menu control from a style in javascript? - asp.netquick search for a small image in a larger image - searchAll Articles