• support@answerspoint.com

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

2830

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 7 years ago
  • Community  wiki

Your Answer

    Facebook Share        
       
  • asked 7 years ago
  • viewed 2830 times
  • active 7 years ago

Best Rated Questions