Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateFormat

Status
Not open for further replies.

andy98

Programmer
Jul 7, 2000
120
GB
Hi

I have the following

echo "Date of Complaint: $row[date_result]<br>";

date_result being a date/timestamp from a mySQL db table.

I have been trying unsuccessfully to perform a date format to get a UK DD-MM-YYYY and a Time.

Can anyone point me in the right direction?

Thanks in advance
 
Hi Rob

I have been trying to use the date_format function but I guess my syntax must be incorrect. I'd appreciate if you have an example!
 
I don't use the TIMESTAMP type myself as I prefer just using the normal DATETIME.

But, this should work...
SELECT DATE_FORMAT(myCol, '%d-%c-%Y') FROM myTable

This works for me :)
 
How would i do the same in my output - having already queried the Database?

echo "Date of Complaint: $row[date_result]<br>";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top