• support@answerspoint.in

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

31
Advertisement

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

Your Answer

    Facebook Share        
       
  • publish 9 years ago
  • viewed 31 times
  • active 9 years ago

Best Rated Questions