Horje
convert date php Code Example
php change date format
To convert the date-time format PHP provides strtotime() and date() function. We change the date format from one format to another.

Change YYYY-MM-DD to DD-MM-YYYY
<? php.
$currDate = "2020-04-18";
$changeDate = date("d-m-Y", strtotime($currDate));
echo "Changed date format is: ". $changeDate. " (MM-DD-YYYY)";
?>
php convert string to date
$time = strtotime('10/16/2003');

$newformat = date('Y-m-d',$time);

echo $newformat;
// 2003-10-16
php string to date
$s = '06/10/2011 19:00:02';
$date = strtotime($s);
echo date('d/M/Y H:i:s', $date);
The above one is the one of the example of converting a string to date.
echo $s ->format('Y-m-d');
The above one is another method 
convert string to date php
$s = '08/11/2010 19:37:02';
$date = strtotime($s);
echo date('Y-m-d H:i:s', $date);
convert date in php
$originalDate = "2010-03-21";
$newDate = date("d-m-Y", strtotime($originalDate));
convert date php
$var = '21/05/2012';
$date = str_replace('/', '-', $var);
echo date('Y-m-d', strtotime($date))




Php

Related
wpml display language switcher Code Example wpml display language switcher Code Example
php rand vs mt_rand Code Example php rand vs mt_rand Code Example
wpml language switcher shortcode Code Example wpml language switcher shortcode Code Example
how to write tests for php Code Example how to write tests for php Code Example
PHP compair datetime Code Example PHP compair datetime Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9