I have this date format d-m-y on a string so that 01-01-12 is January, 1st of the year 2012.
Now, I want to convert this to a date object in php, to sort a set of dates, which are stored as string in an array.
Currently, I’m using strtotime and date
$keypoints[] = date('d-m-y', strtotime($date_str));
But this is sorting the resulting dates as if the format is y-m-d. The question is, how can I set the input format of the strtotime function?
Thanks in advance
Try this to get the date in
Y-m-dformat