• support@answerspoint.com

Convert date format yyyy-mm-dd => dd-mm-yyyy

663

I am trying to convert a date from yyyy-mm-dd to dd-mm-yyyy (but not in SQL); however I don't know how the date function requires a timestamp, and I can't get a timestamp from this string.

How is this possible?

1Answer


0

Use Can Use  strtotime() and date():

$originalDate = "2010-03-21";
$newDate = date("d-m-Y", strtotime($originalDate));

(see strtotime and date docs on the PHP site).

  • answered 1 year ago
  • Community  wiki

Your Answer

    Facebook Share