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!

formatting date pulled from mysql 1

Status
Not open for further replies.

y2k1981

Programmer
Aug 2, 2002
773
IE
If I use a query to pull a date from MySQL and then try to format it using PHP, it always displays 1st Jan 1970 (presumably this is day 1 for php?).

Here's what I've got - assuming that $myvar contains a date pulled from MySQL:
echo "Date: ".date('jS F Y', $myvar);

If I replace $myvar with an integer, it displays the appropriate date, so why won't it work with the variable?
 
if the mysql field is a date column you need to use the strtotime() function in order to change the date column to timestamp.


thanks, you've answered my question there. and thanks for the quick response
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top