Horje
How to create PHP Date formatting

DateTime::createFromFormat -- date_create_from_format — Parses a time string according to a specified format


Example of PHP Date formatting

Here is the right way to use PHP Date formatting
index.php
Example: PHP
<?php
$date = DateTime::createFromFormat('j-M-Y', '02-Jan-2024');
echo $date->format('Y-m-d');
?>

Output should be:

Example of PHP Date formatting





Related Articles
How to convert a timestamp to Minute Ago in PHP PHP Time Tutorial
How to create PHP Date formatting PHP Time Tutorial

Single Articles
Example of PHP Date formattingPHP Time Tutorial

Read Full:
PHP Time Tutorial
Category:
Web Tutorial
Sub Category:
PHP Time Tutorial
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
46
Tested on:
PHP 5.6, 7, 8



Share on: