Wednesday, 7 August 2013

Date issue: always shows 01 Jan rather than converting to desired Date

Date issue: always shows 01 Jan rather than converting to desired Date

I am fairly new to PHP programming and thus am facing a strange problem,
through different forums i was able to learn how to convert dates of
different formats into our desired formats, but today this was not
possible and i was always given 01 Jan no matter what i gave in the
variable, which was strange as previously it was working great. My code is
following:
I am using a combination of date and strtotime PHP functions, as:
$coll_date_1[$i] = $row->coll_date_1; //this is 08-08 i.e 8 Aug
$coll_date_1[$i] = date('d M',strtotime($coll_date_1[$i])); //this return
01 Jan
The 1st line assigns value from database into the variable, and the 2nd
line is the function to convert them into desired format. I know i am
doing a silly mistake, but cant seem to pin point where that is...

No comments:

Post a Comment