• support@answerspoint.com

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

2855

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

Your Answer

    Facebook Share        
       
  • asked 8 years ago
  • viewed 2855 times
  • active 8 years ago

Best Rated Questions