From a query I receive the date as follows:
2018-07-06 22:24:44
Through:
<h4>'.$fecha.'</h4>
How can I change that format, without having to modify the database, how can I convert that date to this format:
Julio 06,2018
From a query I receive the date as follows:
2018-07-06 22:24:44
Through:
<h4>'.$fecha.'</h4>
How can I change that format, without having to modify the database, how can I convert that date to this format:
Julio 06,2018
It is best to work with the functions that PHP already has
Axis:
The date output:
06 de julio de 2018
You can also play around with the code
Axis:
The date output:
Viernes, 6 de julio del 2018
try the following code, which you must assign as you want the date with
m-d-Y
which only the format changes.other ways to do it
Edition 1:
The result is
July 07,18
, the new problem is the languageDocumentation about Date
You can implement PHP's Date function like this:
This is the code:
and it shows you something like this:
I recommend you to use a very good library to parse your dates with PHP and you could easily use it with composer.
To install this library with composer:
Easy to parse your dates with a few lines of code:
In this and many other ways you could change the format of your dates.
Github repository: https://github.com/fightbulc/moment.php