Apparently your add_date column is not a datetime column in the database. Read more in the manual.
pritaeas
Posting Prodigy
9,286 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,457
Skill Endorsements: 86
If your column is a varchar, then you can use the date_create before the date_format, as in the first example in the manual.
pritaeas
Posting Prodigy
9,286 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,457
Skill Endorsements: 86
I think this could help you.
$row_rs_propdetails['add_date']=strtotime($row_rs_propdetails['add_date']);//this will convert mysql text date to php date object
echo date('Y-m-d',$row_rs_propdetails['add_date'] );//now show date object in required format
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24
If your column is a date type then this should work:
echo date('Y-m-d', $row_rs_propdetails['add_date']);
pritaeas
Posting Prodigy
9,286 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,457
Skill Endorsements: 86
Question Answered as of 1 Year Ago by
pritaeas,
urtrivedi
and
Karthik_pranas This worked - as in it removed the time and just left the date - however it switched all the dates to 1970-01-01
Not sure why as it should just be formatting.....
It will not work because php date and mysql date do not recongize each other.
So when you load php variable with mysql datevalue, its just string for it not date.
So we first convert that string to php date object using strtotime function.
then we use that php date object using various php display formats
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24