-2

Currently I have a date in the format: 04/07/2014, (4/7/2014) I need to change this so that it is: 07/04/2014 so I can convert it to a time stamp using: $time1 = strtotime("dd/mm/yy"); I am doing this so I can compare multiple dates. How can I do this using php?

user3505931
  • 259
  • 2
  • 4
  • 10

1 Answers1

0

Here is simple function:

<?php

function format_date($dateToConvert) {

    return date('d/m/Y', strtotime($dateToConvert));
}

$date = "04/07/14";

echo format_date($date);

Output: 07/04/2014

LIVE DEMO

Black Sheep
  • 6,604
  • 7
  • 30
  • 51