Answer the question
In order to leave comments, you need to log in
How to format date?
How to format a date like this 2015-10-28 13:03:12 into
Wen, 28 Oct 2015 13:03:12 +0200 ?
Answer the question
In order to leave comments, you need to log in
echo DateTime::createFromFormat( 'Y-m-d H:i:s', '2015-10-28 13:03:12' )->format( 'r' );
// Wen, 28 Oct 2015 13:03:12 +0200
echo DateTime::createFromFormat( 'Y-m-d H:i:s', '2015-10-28 13:03:12' )->format( DateTime::RFC2822 );
// Wen, 28 Oct 2015 13:03:12 +0200
echo DateTime::createFromFormat( 'Y-m-d H:i:s', '2015-10-28 13:03:12' )->format( 'D, d M Y H:i:s O' );
// Wen, 28 Oct 2015 13:03:12 +0200
echo date( 'r', strtotime( '2015-10-28 13:03:12' ) );
// Wen, 28 Oct 2015 13:03:12 +0200
datetime
$date = DateTime::createFromFormat('Y-m-d H:i:s', '2015-10-28 13:03:12');
echo $date->format(DateTime::RFC2822);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question