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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve a date from a MYSQL db and format in PHP

Status
Not open for further replies.

IanNav

Programmer
Feb 26, 2001
79
Hi,

I'm new to PHP and need some help on a simple problem.

I have a variable $data[date].

I would like to the date to display in "dd/mm/yyyy" format

I am a vb programmer, and would do it as below in vb.


mydate = "2005/11/30"
tmpdate = format(mydate, "DD/MM/YYYY")

result : tmpdate = "30/11/2005"

Please can some post some example code for me.

thanks

Ian

ps, i have looked on php.net and the only examples are how to format the #now# date, i want to format it from a stored date.
 
if you are getting it from mysql, get mysql to format the date for you when you do the select:

select date_format(datefield,'%d/%m/%Y');

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top