Php конвертирует формат строки даты

Примеры кода

7
0

php изменяет формат даты

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)";
?>
2
0

изменить формат даты php

$currDate = "2020-08-25";
$changeDate = date("d-m-Y", strtotime($currDate));
echo $changedDate;
1
0

форматирование даты sting php

# From a date Object:
date_format ( DateTimeInterface $object , string $format )

# From the current time
$dateTime = new \DateTime(); 
// or pass a string or int ->`DateTime($date_time)`
$dateTime->format('y-j-d H:i:s T'); #print ex: 21-2-02 16:00:01 PST

# Or a quick one-liner:
date('g:i A m-d-Y', strtotime($date_time)); #print ex: 2:00 PM 02-02-2021

Похожие страницы

Похожие страницы с примерами

На других языках

Эта страница на других языках

English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................