Hi I am trying to get some PHP date formatting resolved. The problem I am having is random unexpected results being returned instead of the correct date after I try and format them.
I have the date MM/DD/YY
passed in as a string and I am wondering how to convert that to a YYYY/MM/DD
. When it try to convert the date it is like it is staying in the same place but trying to convert the individual section so the MM (12)
goes to the year YYYY (2012)
Here is the section of code I have been using to try and change the format:
$date = $_GET["datepicker"];
$arr[$i] = strftime("%Y-%m-%d", strtotime($date));
The $arr[$i]
is just the array I am putting it into this shouldn't affect anything.
I have also tried the following:
$arr[$i] = date("Y-m-d", strtotime($date));
Thanks,
Kieran