php - convert date format with utc -


this question has answer here:

i want convert date format 'wed, 27 01 2016 00:00:00 est' '2016-01-27'.i got wrong value '1970-01-01'

<?php date_default_timezone_set("europe/helsinki");  $var='wed, 25 11 2015 00:00:00 gmt'; echo $d=date('y-m-d',strtotime($var)); //date_rfc2822 ?> 

it means datetime string cannot recognised automatically. need specify format of input:

echo date_create_from_format(     'd, d m y h:i:s e',  // <== input format       'wed, 27 01 2016 00:00:00 est'  // <== string )->format("y-m-d")  // <== output format 

more formats here: http://php.net/manual/en/datetime.createfromformat.php


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -