php - Convert date from dutch to english -
i thought going quite easy not! have date: mei 28, 2015 (dutch) , convert english y-m-d
problem site multilang stay dynamic (replace mai may) not solution, i've tryed:
setlocale(lc_time, 'nl_nl'); setlocale(lc_all, 'nl_nl'); echo strftime("%y-%m-%d", strtotime($value));
or
$date = date_parse(($value)); print_r($date);
but time i'm getting: 1970-01-01
any ideas?
i'm trying achieve in magento, maybe there magento function this
use strptime() function - http://php.net/manual/en/function.strptime.php
$value = 'mei 28, 2015'; $format = '%b %d, %y'; setlocale(lc_time, 'nl_nl'); setlocale(lc_all, 'nl_nl'); // array date details $result = strptime($value, $format); $day = str_pad($result['tm_mday'] + 1, 2, '0', str_pad_left); $month = str_pad($result['tm_mon'] + 1, 2, '0', str_pad_left); $year = $result['tm_year'] + 1900; print $year.'-'.$month.'-'.$day;
Comments
Post a Comment