I adjusted my html to be right to left and the database also to read right to left languages ex. Arabic, but the date shows in a corrupted format in the database browsing from PHP my admin, and also when retrieved in the browser it also is received in the same corrupted format, which is : 2002-09-15 and its supposed to be 02-09-2015, how can I fix this ?
It's possible the only logical thing would be take it apart and put it back together again with regex:
$date = "2002-09-15";
$newd = preg_replace( '/(\d{2})(\d{2})-(\d{2})-(\d{2})/', '\2-\3-\1\4', $date);
echo $newd;
Result:
02-09-2015
I would normally tell you to use date_format
, although I don't think it will work in this situation because of the year being mucked like it is.