php zmena formátu dátumu
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)";
?>
zmena formátu dátumu php
$currDate = "2020-08-25";
$changeDate = date("d-m-Y", strtotime($currDate));
echo $changedDate;
zmena formátu datetime Z Y-m-d h:i:S na d-M-Y v php
$old_date = date('l, F d y h:i:s'); // returns Saturday, January 30 10 02:06:34
$old_date_timestamp = strtotime($old_date);
$new_date = date('Y-m-d H:i:s', $old_date_timestamp);
php dátum strtotime formát
$date = '25/05/2010';
$date = str_replace('/', '-', $date);
echo date('Y-m-d', strtotime($date));